├── .cargo └── config.toml ├── src ├── view │ ├── widgets │ │ ├── mod.rs │ │ └── buttons.rs │ ├── mod.rs │ ├── notification_toast.rs │ ├── palette.rs │ ├── dropdown.rs │ ├── bottom_bar.rs │ ├── sidebar.rs │ ├── top_bar.rs │ ├── app_view.rs │ └── docview.rs ├── data │ ├── mod.rs │ ├── types.rs │ ├── themes.rs │ ├── stores.rs │ └── io.rs ├── static │ ├── icon.png │ ├── icons │ │ ├── 32x32.png │ │ ├── 64x64.png │ │ ├── icon.icns │ │ ├── icon.ico │ │ ├── icon.png │ │ ├── 128x128.png │ │ ├── 128x128@2x.png │ │ ├── StoreLogo.png │ │ ├── Square30x30Logo.png │ │ ├── Square44x44Logo.png │ │ ├── Square71x71Logo.png │ │ ├── Square89x89Logo.png │ │ ├── Square107x107Logo.png │ │ ├── Square142x142Logo.png │ │ ├── Square150x150Logo.png │ │ ├── Square284x284Logo.png │ │ ├── Square310x310Logo.png │ │ └── ios │ │ │ ├── AppIcon-20x20@1x.png │ │ │ ├── AppIcon-20x20@2x.png │ │ │ ├── AppIcon-20x20@3x.png │ │ │ ├── AppIcon-29x29@1x.png │ │ │ ├── AppIcon-29x29@2x.png │ │ │ ├── AppIcon-29x29@3x.png │ │ │ ├── AppIcon-40x40@1x.png │ │ │ ├── AppIcon-40x40@2x.png │ │ │ ├── AppIcon-40x40@3x.png │ │ │ ├── AppIcon-512@2x.png │ │ │ ├── AppIcon-60x60@2x.png │ │ │ ├── AppIcon-60x60@3x.png │ │ │ ├── AppIcon-76x76@1x.png │ │ │ ├── AppIcon-76x76@2x.png │ │ │ ├── AppIcon-20x20@2x-1.png │ │ │ ├── AppIcon-29x29@2x-1.png │ │ │ ├── AppIcon-40x40@2x-1.png │ │ │ └── AppIcon-83.5x83.5@2x.png │ ├── fonts │ │ ├── JetBrainsMono[wght].ttf │ │ ├── JetBrainsMono-Regular.ttf │ │ └── JetBrainsMono-Italic[wght].ttf │ └── svgs │ │ ├── minimise.svg │ │ ├── close.svg │ │ ├── chevron-right.svg │ │ ├── info.svg │ │ ├── restore.svg │ │ ├── keyboard.svg │ │ ├── palette.svg │ │ ├── sliders-horizontal.svg │ │ ├── maximise.svg │ │ ├── close_old.svg │ │ ├── command_palette.svg │ │ ├── recent_files.svg │ │ └── settings.svg └── main.rs ├── packaging ├── build.md ├── linux │ ├── Rhyolite.desktop │ ├── flatpak │ │ ├── io.github.redddfoxxyy.rhyolite.desktop │ │ ├── build.sh │ │ ├── io.github.redddfoxxyy.rhyolite.yml │ │ └── io.github.redddfoxxyy.rhyolite.metainfo.xml │ ├── Rhyolite.metainfo.xml │ ├── appimage │ │ └── build.sh │ ├── uninstall.sh │ ├── Rhyolite.spec │ └── install.sh ├── README.md └── package_app.sh ├── rustfmt.toml ├── assets ├── Rhyolite_is_Cool!.png └── rhyolite_command_preview.png ├── .gitattributes ├── app_themes ├── greenScreen.toml ├── rosePineDawn.toml ├── rosePineMain.toml ├── rosePineMoon.toml ├── catppuccinLatte.toml ├── catppuccinMocha.toml ├── crimsonNocturne.toml ├── tokyoNightDark.toml ├── gruvboxMaterialDark(Hard).toml ├── gruvboxMaterialLight(Hard).toml ├── default.toml ├── coffee.toml └── catppuccinMacchiato.toml ├── Packager.toml ├── .github ├── workflows │ ├── rust_ci.yml │ ├── nightly_release.yml │ └── stable_release.yml ├── CODE_OF_CONDUCT.md └── CONTRIBUTING.md ├── Cargo.toml ├── README.md ├── .gitignore └── LICENSE.txt /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/view/widgets/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod buttons; 2 | -------------------------------------------------------------------------------- /packaging/build.md: -------------------------------------------------------------------------------- 1 | build version: 0.1.5 2 | build count: 2 3 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | edition = "2024" 2 | hard_tabs = true 3 | tab_spaces = 4 4 | max_width = 140 5 | -------------------------------------------------------------------------------- /src/data/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod io; 2 | pub mod stores; 3 | pub mod themes; 4 | pub mod types; 5 | -------------------------------------------------------------------------------- /src/static/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icon.png -------------------------------------------------------------------------------- /src/static/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/32x32.png -------------------------------------------------------------------------------- /src/static/icons/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/64x64.png -------------------------------------------------------------------------------- /src/static/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/icon.icns -------------------------------------------------------------------------------- /src/static/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/icon.ico -------------------------------------------------------------------------------- /src/static/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/icon.png -------------------------------------------------------------------------------- /assets/Rhyolite_is_Cool!.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/assets/Rhyolite_is_Cool!.png -------------------------------------------------------------------------------- /src/static/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/128x128.png -------------------------------------------------------------------------------- /src/static/icons/128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/128x128@2x.png -------------------------------------------------------------------------------- /src/static/icons/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/StoreLogo.png -------------------------------------------------------------------------------- /assets/rhyolite_command_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/assets/rhyolite_command_preview.png -------------------------------------------------------------------------------- /src/static/icons/Square30x30Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square30x30Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square44x44Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square44x44Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square71x71Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square71x71Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square89x89Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square89x89Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square107x107Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square107x107Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square142x142Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square142x142Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square150x150Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square150x150Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square284x284Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square284x284Logo.png -------------------------------------------------------------------------------- /src/static/icons/Square310x310Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/Square310x310Logo.png -------------------------------------------------------------------------------- /src/static/fonts/JetBrainsMono[wght].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/fonts/JetBrainsMono[wght].ttf -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-20x20@1x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-20x20@2x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-20x20@3x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-29x29@1x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-29x29@2x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-29x29@3x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-40x40@1x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-40x40@2x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-40x40@3x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-512@2x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-60x60@2x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-60x60@3x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-76x76@1x.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-76x76@2x.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | src-webpage/* linguist-vendored 2 | * linguist-vendored 3 | *.rs linguist-vendored=false 4 | *.nix linguist-vendored=false 5 | -------------------------------------------------------------------------------- /src/static/fonts/JetBrainsMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/fonts/JetBrainsMono-Regular.ttf -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-20x20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-20x20@2x-1.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-29x29@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-29x29@2x-1.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-40x40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-40x40@2x-1.png -------------------------------------------------------------------------------- /src/static/icons/ios/AppIcon-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/icons/ios/AppIcon-83.5x83.5@2x.png -------------------------------------------------------------------------------- /src/static/fonts/JetBrainsMono-Italic[wght].ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lockedmutex/rhyolite/HEAD/src/static/fonts/JetBrainsMono-Italic[wght].ttf -------------------------------------------------------------------------------- /src/view/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod app_view; 2 | pub mod bottom_bar; 3 | pub mod docview; 4 | pub mod dropdown; 5 | pub mod palette; 6 | pub mod sidebar; 7 | pub mod top_bar; 8 | mod widgets; 9 | -------------------------------------------------------------------------------- /src/static/svgs/minimise.svg: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /packaging/linux/Rhyolite.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=Utility;TextEditor; 3 | Name=Rhyolite 4 | Comment=A simple markdown editor written in Rust. 5 | Exec=Rhyolite 6 | Icon=Rhyolite 7 | Terminal=false 8 | Type=Application 9 | StartupWMClass=Rhyolite 10 | -------------------------------------------------------------------------------- /packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=Utility;TextEditor; 3 | Name=Rhyolite 4 | Comment=A simple markdown editor written in Rust. 5 | Exec=Rhyolite 6 | Icon=io.github.redddfoxxyy.rhyolite 7 | Terminal=false 8 | Type=Application 9 | -------------------------------------------------------------------------------- /packaging/linux/flatpak/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | arch=$(uname -m) 4 | bundle_name="Rhyolite-${arch}.flatpak" 5 | 6 | flatpak-builder --force-clean --repo=repo build-dir io.github.redddfoxxyy.rhyolite.yml 7 | flatpak build-bundle repo "${bundle_name}" io.github.redddfoxxyy.rhyolite 8 | -------------------------------------------------------------------------------- /packaging/README.md: -------------------------------------------------------------------------------- 1 | # App Packaging Commands: 2 | 3 | ## Linux: 4 | 5 | - `cargo build --release` 6 | - `cd target/release` 7 | - `linuxdeploy.appimage --appdir AppDir --executable ../target/release/Rhyolite --output appimage --desktop-file ./linux/Rhyolite.desktop --icon-file ./linux/Rhyolite.svg` -------------------------------------------------------------------------------- /src/static/svgs/close.svg: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /src/static/svgs/chevron-right.svg: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /src/static/svgs/info.svg: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /src/static/svgs/restore.svg: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /app_themes/greenScreen.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Green Screen" 3 | author = "Rhyolite Team" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#e5ffe6" 9 | subtext2 = "#def8df" 10 | subtext1 = "#d4eed5" 11 | subtext0 = "#c4ddc5" 12 | overlay2 = "#c4ddce" 13 | overlay1 = "#ceddc4" 14 | overlay0 = "#a1b9ab" 15 | surface2 = "#a1b9a1" 16 | surface1 = "#819982" 17 | surface0 = "#5a705b" 18 | base = "#475c48" 19 | crust = "#293e2a" 20 | mantle = "#081d08" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /app_themes/rosePineDawn.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Rose Pine Dawn" 3 | author = "Shravya Kudlu" 4 | themetype = "Basic" 5 | colorscheme = "Light" 6 | 7 | [colors] 8 | text = "#575279" 9 | subtext2 = "#e0b94b" 10 | subtext1 = "#d59a42" 11 | subtext0 = "#c9944f" 12 | overlay2 = "#d29b7e" 13 | overlay1 = "#d29b7e" 14 | overlay0 = "#b07a5f" 15 | surface2 = "#f9d39f" 16 | surface1 = "#eec5c4" 17 | surface0 = "#fffaf3" 18 | base = "#f2e9e1" 19 | crust = "#faf4ed" 20 | mantle = "#e0c7b6" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" -------------------------------------------------------------------------------- /app_themes/rosePineMain.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Rose Pine Main" 3 | author = "Shravya Kudlu" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#c4a7e7" 9 | subtext2 = "#e0def4" 10 | subtext1 = "#d8dbde" 11 | subtext0 = "#c2c6cb" 12 | overlay2 = "#26233a" 13 | overlay1 = "#6e6a86" 14 | overlay0 = "#26233a" 15 | surface2 = "#6e6a86" 16 | surface1 = "#524f67" 17 | surface0 = "#403d52" 18 | base = "#26233a" 19 | crust = "#191724" 20 | mantle = "#c4a7e7" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /app_themes/rosePineMoon.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Rose Pine Moon" 3 | author = "Shravya Kudlu" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#c4a7e7" 9 | subtext2 = "#a58bc3" 10 | subtext1 = "#bfa0d7" 11 | subtext0 = "#b493c1" 12 | overlay2 = "#2d2b3b" 13 | overlay1 = "#e0def4" 14 | overlay0 = "#b8b5c9" 15 | surface2 = "#908caa" 16 | surface1 = "#2a273f" 17 | surface0 = "#6e6a86" 18 | base = "#393552" 19 | crust = "#2a283e" 20 | mantle = "#3b334b" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /src/static/svgs/keyboard.svg: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /app_themes/catppuccinLatte.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Catppuccin Latte" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#4c4f69" 9 | subtext2 = "#5a5d75" 10 | subtext1 = "#5c5f77" 11 | subtext0 = "#6c6f85" 12 | overlay2 = "#75788c" 13 | overlay1 = "#7c7f93" 14 | overlay0 = "#8c8fa1" 15 | surface2 = "#9ca0b0" 16 | surface1 = "#acb0be" 17 | surface0 = "#bcc0cc" 18 | base = "#ccd0da" 19 | crust = "#eff1f5" 20 | mantle = "#e6e9ef" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /app_themes/catppuccinMocha.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Catppuccin Mocha" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#cdd6f4" 9 | subtext2 = "#bec6e0" 10 | subtext1 = "#bac2de" 11 | subtext0 = "#a6adc8" 12 | overlay2 = "#989db5" 13 | overlay1 = "#9399b2" 14 | overlay0 = "#7f849c" 15 | surface2 = "#6c7086" 16 | surface1 = "#585b70" 17 | surface0 = "#45475a" 18 | base = "#313244" 19 | crust = "#1e1e2e" 20 | mantle = "#181825" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /app_themes/crimsonNocturne.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Crimson Nocturne" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#FADCD5" 9 | subtext2 = "#FADCD5" 10 | subtext1 = "#765D67" 11 | subtext0 = "#6D3C52" 12 | overlay2 = "#765D67" 13 | overlay1 = "#6D3C52" 14 | overlay0 = "#4B2138" 15 | surface2 = "#765D67" 16 | surface1 = "#6D3C52" 17 | surface0 = "#6D3C52" 18 | base = "#4B2138" 19 | crust = "#1B0C1A" 20 | mantle = "#2D222F" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /packaging/linux/Rhyolite.metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Rhyolite.desktop 4 | Rhyolite 5 | A simple markdown editor written in Rust. 6 | 7 | Rhyolite is a simple markdown editor build using tauri framework that allows user to edit and work on markdown files. 8 | 9 | GPL-3.0 10 | https://github.com/rhyolite-org/rhyolite 11 | Rhyolite.desktop 12 | Rhyolite 13 | 14 | -------------------------------------------------------------------------------- /app_themes/tokyoNightDark.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Tokyo Night Dark" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#D5D6DB" 9 | subtext2 = "#D0D1D6" 10 | subtext1 = "#CBCCD1" 11 | subtext0 = "#BABED4" 12 | overlay2 = "#A9B1D6" 13 | overlay1 = "#9197B7" 14 | overlay0 = "#787C99" 15 | surface2 = "#5E6482" 16 | surface1 = "#444B6A" 17 | surface0 = "#2F3549" 18 | base = "#252838" 19 | crust = "#1A1B26" 20 | mantle = "#16161E" 21 | accent = "#2AC3DE" 22 | highlight = "#F7768E" 23 | border = "#BB9AF7" 24 | -------------------------------------------------------------------------------- /packaging/linux/appimage/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | arch=$(uname -m) 4 | if [[ "$arch" == x86_64 ]]; then 5 | curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-x86_64.AppImage 6 | else 7 | curl -L -O https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-aarch64.AppImage 8 | fi 9 | 10 | chmod +x linuxdeploy-x86_64.AppImage 11 | 12 | cd ../../../ 13 | cargo build --release 14 | 15 | cd packaging/linux/appimage || exit 16 | ./linuxdeploy-x86_64.AppImage --appdir AppDir --executable ../../../target/release/Rhyolite --output appimage --desktop-file ../Rhyolite.desktop --icon-file ../Rhyolite.svg -------------------------------------------------------------------------------- /app_themes/gruvboxMaterialDark(Hard).toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Gruvbox Material Dark(Hard)" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#fbf1c7" 9 | subtext2 = "#f3e6bd" 10 | subtext1 = "#ebdbb2" 11 | subtext0 = "#e4d1aa" 12 | overlay2 = "#ddc7a1" 13 | overlay1 = "#cdbb9a" 14 | overlay0 = "#bdae93" 15 | surface2 = "#8c8070" 16 | surface1 = "#5a524c" 17 | surface0 = "#504945" 18 | base = "#3d3936" 19 | crust = "#2a2827" 20 | mantle = "#202020" 21 | accent = "#ea6962" 22 | highlight = "#e78a4e" 23 | border = "#7daea3" 24 | -------------------------------------------------------------------------------- /app_themes/gruvboxMaterialLight(Hard).toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Gruvbox Material Light(Hard)" 3 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 4 | themetype = "Basic" 5 | colorscheme = "Light" 6 | 7 | [colors] 8 | text = "#282828" 9 | subtext2 = "#32302f" 10 | subtext1 = "#3c3836" 11 | subtext0 = "#514036" 12 | overlay2 = "#654735" 13 | overlay1 = "#866e5d" 14 | overlay0 = "#a89984" 15 | surface2 = "#b9a98f" 16 | surface1 = "#c9b99a" 17 | surface0 = "#e0cfa9" 18 | base = "#eedcb8" 19 | crust = "#fbf1c7" 20 | mantle = "#f9f5d7" 21 | accent = "#c14a4a" 22 | highlight = "#c35e0a" 23 | border = "#45707a" 24 | -------------------------------------------------------------------------------- /app_themes/default.toml: -------------------------------------------------------------------------------- 1 | [info] 2 | name = "Default" 3 | author = "Rhyolite Team" 4 | themetype = "Basic" 5 | colorscheme = "Dark" 6 | 7 | [colors] 8 | text = "#ffffff" 9 | subtext2 = "#f1f2f3" 10 | subtext1 = "#d8dbde" 11 | subtext0 = "#c2c6cb" 12 | overlay2 = "#acb2b8" 13 | overlay1 = "#969da5" 14 | overlay0 = "#808992" 15 | surface2 = "#6c757d" # Applied to close tab icon hover background. 16 | surface1 = "#596167" # Applied to tab buttons when hovered. 17 | surface0 = "#464c51" # Applied to tab buttons. 18 | base = "#33373b" # Applied to TitleBar/TabsBar. 19 | crust = "#202325" 20 | mantle = "#0d0e0f" 21 | accent = "#ff4081" 22 | highlight = "#ffa726" 23 | border = "#424242" 24 | -------------------------------------------------------------------------------- /packaging/package_app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURRENT_OS=$(uname -s) 4 | echo "Running packaging tasks for Rhyolite..." 5 | cd .. 6 | cargo install cargo-packager --locked 7 | cargo build --release 8 | cargo packager --release --config Packager.toml 9 | 10 | if [ "$CURRENT_OS" = "Linux" ]; then 11 | echo "Operating system is Linux. Running RPM and Flatpak builds..." 12 | cargo install cargo-generate-rpm 13 | strip -s target/release/Rhyolite 14 | cargo generate-rpm 15 | cd packaging/linux/flatpak || exit 16 | chmod +x build.sh 17 | ./build.sh 18 | else 19 | echo "Operating system is '$CURRENT_OS', not Linux. Skipping RPM and Flatpak steps." 20 | fi 21 | 22 | echo "Script finished." -------------------------------------------------------------------------------- /src/static/svgs/palette.svg: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /src/view/notification_toast.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | -------------------------------------------------------------------------------- /src/static/svgs/sliders-horizontal.svg: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /src/static/svgs/maximise.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | -------------------------------------------------------------------------------- /src/static/svgs/close_old.svg: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /src/static/svgs/command_palette.svg: -------------------------------------------------------------------------------- 1 | 15 | 16 | 36 | -------------------------------------------------------------------------------- /app_themes/coffee.toml: -------------------------------------------------------------------------------- 1 | # { 2 | # "name": "Coffee", 3 | # "colorscheme": "light", 4 | # "colors": { 5 | # "text": "#FFDBB5", 6 | # "subtext2": "#FFEAC5", 7 | # "subtext1": "#d8dbde", 8 | # "subtext0": "#c2c6cb", 9 | # "overlay2": "#acb2b8", 10 | # "overlay1": "#969da5", 11 | # "overlay0": "#808992", 12 | # "surface2": "#a07349", 13 | # "surface1": "#845f3c", 14 | # "surface0": "#684b2f", 15 | # "base": "#4c3622", 16 | # "crust": "#2f2215", 17 | # "mantle": "#130e09" 18 | # } 19 | # } 20 | 21 | [info] 22 | name = "Coffee" 23 | author = "Rhyolite Team" 24 | themetype = "Basic" 25 | colorscheme = "Dark" 26 | 27 | [colors] 28 | text = "#FFDBB5" 29 | subtext2 = "#FFEAC5" 30 | subtext1 = "#d8dbde" 31 | subtext0 = "#c2c6cb" 32 | overlay2 = "#acb2b8" 33 | overlay1 = "#969da5" 34 | overlay0 = "#808992" 35 | surface2 = "#a07349" 36 | surface1 = "#845f3c" 37 | surface0 = "#684b2f" 38 | base = "#4c3622" 39 | crust = "#2f2215" 40 | mantle = "#130e09" 41 | accent = "#ff4081" 42 | highlight = "#ffa726" 43 | border = "#424242" 44 | -------------------------------------------------------------------------------- /packaging/linux/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | APP_NAME="Rhyolite" 6 | INSTALL_DIR="$HOME/.local/bin" 7 | DESKTOP_FILE_DIR="$HOME/.local/share/applications" 8 | ICON_DIR="$HOME/.local/share/icons" 9 | 10 | echo "Uninstalling $APP_NAME..." 11 | 12 | # Remove the binary 13 | if [ -f "$INSTALL_DIR/$APP_NAME" ]; then 14 | rm "$INSTALL_DIR/$APP_NAME" 15 | echo "Removed binary from $INSTALL_DIR" 16 | fi 17 | 18 | # Remove the desktop entry 19 | DESKTOP_FILE="$DESKTOP_FILE_DIR/$APP_NAME.desktop" 20 | if [ -f "$DESKTOP_FILE" ]; then 21 | rm "$DESKTOP_FILE" 22 | echo "Removed desktop entry from $DESKTOP_FILE_DIR" 23 | fi 24 | 25 | # Remove the icon 26 | ICON_FILE="$ICON_DIR/$APP_NAME.png" 27 | if [ -f "$ICON_FILE" ]; then 28 | rm "$ICON_FILE" 29 | echo "Removed icon from $ICON_DIR" 30 | fi 31 | 32 | # Refresh desktop database 33 | if command -v update-desktop-database >/dev/null 2>&1; then 34 | update-desktop-database "$HOME/.local/share/applications" 35 | echo "Updated desktop database" 36 | fi 37 | 38 | echo "$APP_NAME has been successfully uninstalled." -------------------------------------------------------------------------------- /src/static/svgs/recent_files.svg: -------------------------------------------------------------------------------- 1 | 13 | 17 | 18 | 28 | -------------------------------------------------------------------------------- /app_themes/catppuccinMacchiato.toml: -------------------------------------------------------------------------------- 1 | # { 2 | # "name": "Catppuccin Macchiato", 3 | # "colorscheme": "dark", 4 | # "colors": { 5 | # "text": "#cad3f5", 6 | # "subtext2": "#bec5e0", 7 | # "subtext1": "#b8c0e0", 8 | # "subtext0": "#a5adcb", 9 | # "overlay2": "#939ab7", 10 | # "overlay1": "#8087a2", 11 | # "overlay0": "#6e738d", 12 | # "surface2": "#5e6277", 13 | # "surface1": "#5b6078", 14 | # "surface0": "#494d64", 15 | # "base": "#363a4f", 16 | # "crust": "#24273a", 17 | # "mantle": "#1e2030" 18 | # } 19 | # } 20 | 21 | [info] 22 | name = "Catppuccin Macchiato" 23 | author = "RedddFoxxyy (aka Suyog Tandel) (https://github.com/RedddFoxxyy)" 24 | themetype = "Basic" 25 | colorscheme = "Dark" 26 | 27 | [colors] 28 | text = "#cad3f5" 29 | subtext2 = "#bec5e0" 30 | subtext1 = "#b8c0e0" 31 | subtext0 = "#a5adcb" 32 | overlay2 = "#939ab7" 33 | overlay1 = "#8087a2" 34 | overlay0 = "#6e738d" 35 | surface2 = "#5e6277" 36 | surface1 = "#5b6078" 37 | surface0 = "#494d64" 38 | base = "#363a4f" 39 | crust = "#24273a" 40 | mantle = "#1e2030" 41 | accent = "#ff4081" 42 | highlight = "#ffa726" 43 | border = "#424242" 44 | -------------------------------------------------------------------------------- /Packager.toml: -------------------------------------------------------------------------------- 1 | name = "Rhyolite" 2 | productName = "Rhyolite" 3 | description = "A simple markdown editor written in Rust, inspired by Obsidian." 4 | category = "Utility" 5 | version = "0.2.0" 6 | authors = ["Suyog Tandel(RedddFoxxyy)"] 7 | identifier = "io.github.redddfoxxyy.rhyolite" 8 | license_file = "LICENSE.txt" 9 | icons = [ 10 | "./src/static/icons/icon.png", 11 | "./src/static/icons/icon.ico", 12 | "./src/static/icons/32x32.png", 13 | "./src/static/icons/64x64.png", 14 | "./src/static/icons/128x128.png", 15 | "./src/static/icons/128x128@2x.png", 16 | "./src/static/icons/Square284x284Logo.png", 17 | "./src/static/icons/Square310x310Logo.png", 18 | "./src/static/icons/Square30x30Logo.png", 19 | ] 20 | beforePackagingCommand = "cargo build --release" 21 | binaries = [ 22 | { main = true, path = "../../target/release/Rhyolite" } 23 | ] 24 | outDir = "packaging/cargoPackager" 25 | 26 | [deb] 27 | depends = [ 28 | "libegl1", 29 | "libgl1", 30 | "libx11-6", 31 | "libxcb1", 32 | "libxau6", 33 | "libxdmcp6", 34 | "libfontconfig1", 35 | "libfreetype6", 36 | "libpng16-16", 37 | "libexpat1", 38 | "zlib1g", 39 | "libbrotli1", 40 | "libstdc++6", 41 | "libgcc-s1", 42 | ] 43 | section = "utils" 44 | -------------------------------------------------------------------------------- /packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.yml: -------------------------------------------------------------------------------- 1 | app-id: io.github.redddfoxxyy.rhyolite 2 | runtime: org.freedesktop.Platform 3 | runtime-version: "24.08" 4 | sdk: org.freedesktop.Sdk 5 | sdk-extensions: 6 | - org.freedesktop.Sdk.Extension.rust-stable 7 | 8 | command: Rhyolite 9 | finish-args: 10 | - --share=ipc 11 | - --socket=wayland 12 | - --socket=fallback-x11 13 | - --device=dri 14 | - --filesystem=xdg-documents:create 15 | 16 | modules: 17 | - name: rhyolite 18 | buildsystem: simple 19 | build-options: 20 | append-path: /usr/lib/sdk/rust-stable/bin 21 | build-args: 22 | - --share=network 23 | sources: 24 | - type: git 25 | url: https://github.com/RedddFoxxyy/rhyolite.git 26 | branch: master 27 | 28 | build-commands: 29 | - cargo build --release 30 | - mkdir -p /app/bin/ 31 | - cp -r target/release/Rhyolite /app/bin/ 32 | 33 | - install -Dm644 packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.desktop /app/share/applications/io.github.redddfoxxyy.rhyolite.desktop 34 | - install -Dm644 packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.svg /app/share/icons/hicolor/scalable/apps/io.github.redddfoxxyy.rhyolite.svg 35 | - install -Dm644 packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.metainfo.xml /app/share/metainfo/io.github.redddfoxxyy.rhyolite.metainfo.xml 36 | -------------------------------------------------------------------------------- /packaging/linux/flatpak/io.github.redddfoxxyy.rhyolite.metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.github.redddfoxxyy.rhyolite 4 | 5 | Rhyolite 6 | Elevate Your Notes. 7 | CC0-1.0 8 | GPL-3.0 9 | Suyog Tandel 10 | 11 | 12 | Open-source Markdown editor to connect your ideas. 13 | 14 | 15 | io.github.redddfoxxyy.rhyolite.desktop 16 | 17 | 18 | keyboard 19 | pointing 20 | 768 21 | 22 | 23 | 24 | Productivity 25 | Markdown 26 | Editor 27 | Knowledge-Base 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | https://rhyolite.xyz/ 41 | https://github.com/RedddFoxxyy/rhyolite/issues 42 | https://github.com/RedddFoxxyy/rhyolite 43 | 44 | -------------------------------------------------------------------------------- /packaging/linux/Rhyolite.spec: -------------------------------------------------------------------------------- 1 | Name: Rhyolite 2 | Version: 0.1.0 3 | Release: 1%{?dist} 4 | Summary: Rhyolite - A simple text editor written in Rust using Tauri, inspired by Obsidian. 5 | 6 | License: Apache-2.0 7 | URL: https://www.apache.org/licenses/LICENSE-2.0 8 | Source0: %{name}-%{version}.tar.gz 9 | Source1: %{name}-%{version}.tar.gz/%{name}.png 10 | Source2: %{name}-%{version}.tar.gz/%{name}.desktop 11 | 12 | Requires: glibc, gtk3, webkit2gtk3 13 | 14 | %description 15 | Rhyolite - A simple text editor written in Rust using Tauri, inspired by Obsidian. 16 | 17 | 18 | %prep 19 | %autosetup 20 | 21 | 22 | %build 23 | %global debug_package %{nil} 24 | CFLAGS="%{optflags}" 25 | 26 | 27 | %install 28 | # Install the binary 29 | install -Dm755 %{_builddir}/%{name}-%{version}/%{name} %{buildroot}%{_bindir}/%{name} 30 | 31 | # Install the icon 32 | install -Dm644 %{_builddir}/%{name}-%{version}/%{name}.png %{buildroot}%{_datadir}/icons/hicolor/1080x1080/apps/%{name}.png 33 | 34 | # Install the .desktop file 35 | install -Dm644 %{_builddir}/%{name}-%{version}/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop 36 | 37 | 38 | %files 39 | %{_bindir}/%{name} 40 | %{_datadir}/icons/hicolor/1080x1080/apps/%{name}.png 41 | %{_datadir}/applications/%{name}.desktop 42 | 43 | 44 | 45 | %changelog 46 | * Tue Dec 17 2024 Suyog Tandel <127536688+RedddFoxxyy@users.noreply.github.com> 47 | - 48 | -------------------------------------------------------------------------------- /.github/workflows/rust_ci.yml: -------------------------------------------------------------------------------- 1 | name: Rust CI Pipeline 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - release 8 | paths: 9 | - "src/**" 10 | - "Cargo.toml" 11 | - "Cargo.lock" 12 | 13 | pull_request: 14 | paths: 15 | - "src/**" 16 | - "Cargo.toml" 17 | - "Cargo.lock" 18 | 19 | jobs: 20 | build: 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - name: Checkout code 25 | uses: actions/checkout@v4 26 | 27 | - name: Setup Rust toolchain 28 | uses: actions-rust-lang/setup-rust-toolchain@v1 29 | with: 30 | components: clippy, rustfmt 31 | 32 | - name: Install dependencies (ubuntu only) 33 | run: | 34 | sudo apt-get update 35 | sudo apt-get install -y \ 36 | libegl1 libgl1 libx11-6 libxcb1 libxau6 libxdmcp6 \ 37 | libfontconfig1 libfreetype6 libpng16-16 libexpat1 \ 38 | zlib1g libbrotli1 libstdc++6 libgcc-s1 \ 39 | libfreetype6-dev \ 40 | libfontconfig1-dev \ 41 | libegl1-mesa-dev \ 42 | libgl1-mesa-dev \ 43 | libwayland-egl1-mesa \ 44 | libgles2-mesa-dev \ 45 | libwayland-egl-backend-dev \ 46 | libwayland-dev 47 | 48 | - name: Check formatting 49 | run: cargo fmt --all -- --check 50 | 51 | - name: Run linter 52 | run: cargo clippy --all-targets --all-features -- -D warnings 53 | 54 | - name: Build project 55 | run: cargo build --verbose --all-features -------------------------------------------------------------------------------- /src/view/palette.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use freya::prelude::*; 17 | 18 | use crate::data::stores::THEME_STORE; 19 | 20 | #[component] 21 | pub fn palette_box(children: Element) -> Element { 22 | let theme = THEME_STORE().current_theme.colors; 23 | let mut _focus = use_focus(); 24 | rsx!(rect { 25 | width: "50%", 26 | height: "40%", 27 | min_width: "200", 28 | min_height: "100", 29 | max_height: "400", 30 | background: "{theme.crust}", 31 | shadow: "0 0 20 2 rgb(0, 0, 0, 102)", 32 | padding: "12", 33 | corner_radius: "8", 34 | corner_smoothing: "100%", 35 | onclick: move |e| { 36 | e.stop_propagation(); 37 | } , 38 | paragraph { 39 | text { 40 | color: "{theme.text}", 41 | font_size: "28", 42 | font_family: "JetBrains Mono", 43 | "To Be Implemented." 44 | } 45 | } 46 | {children} 47 | }) 48 | } 49 | -------------------------------------------------------------------------------- /packaging/linux/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | APP_NAME="Rhyolite" 6 | BINARY_URL="https://github.com/rhyolite-org/rhyolite/releases/download/v0.1.5/Rhyolite_0.1.5_x86_64_linux_binary" 7 | ICON_URL="https://raw.githubusercontent.com/rhyolite-org/Rhyolite/master/src-tauri/icons/icon.png" 8 | INSTALL_DIR="$HOME/.local/bin" 9 | DESKTOP_FILE_DIR="$HOME/.local/share/applications" 10 | ICON_DIR="$HOME/.local/share/icons" 11 | 12 | echo "Installing $APP_NAME..." 13 | 14 | # Download the binary 15 | curl -L $BINARY_URL -o /tmp/$APP_NAME 16 | chmod +x /tmp/$APP_NAME 17 | 18 | # Move the binary to the installation directory 19 | mkdir -p $INSTALL_DIR 20 | mv /tmp/$APP_NAME $INSTALL_DIR/$APP_NAME 21 | 22 | # Download and install the icon 23 | mkdir -p $ICON_DIR 24 | curl -L $ICON_URL -o $ICON_DIR/$APP_NAME.png 25 | # mv /tmp/$APP_NAME.png $ICON_DIR/$APP_NAME.png 26 | 27 | # Create a .desktop file 28 | mkdir -p $DESKTOP_FILE_DIR 29 | DESKTOP_FILE=$DESKTOP_FILE_DIR/$APP_NAME.desktop 30 | 31 | cat < $DESKTOP_FILE 32 | [Desktop Entry] 33 | Type=Application 34 | Name=$APP_NAME 35 | Comment=A simple text editor written in Rust using Tauri. 36 | Exec=$INSTALL_DIR/$APP_NAME 37 | Icon=$ICON_DIR/$APP_NAME.png 38 | Terminal=false 39 | Categories=Utility;TextEditor; 40 | Author=Suyog Tandel 41 | EOF 42 | 43 | chmod +x $DESKTOP_FILE 44 | 45 | echo "$APP_NAME installed successfully!" 46 | 47 | # Refresh desktop database 48 | if command -v update-desktop-database >/dev/null 2>&1; then 49 | update-desktop-database "$HOME/.local/share/applications" 50 | fi 51 | 52 | echo "You can now find $APP_NAME in your application menu." 53 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | #![cfg_attr(all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows")] 17 | 18 | mod data; 19 | mod view; 20 | 21 | use data::{io::logger_init, stores::JET_BRAINS_MONO}; 22 | use freya::prelude::*; 23 | use view::app_view::app; 24 | 25 | const APP_ICON: &[u8] = include_bytes!("./static/icon.png"); 26 | 27 | fn main() { 28 | logger_init(); 29 | 30 | log::info!("Rhyolite App started, initialising GUI."); 31 | 32 | launch_cfg( 33 | LaunchConfig::new() 34 | .with_font("JetBrains Mono", JET_BRAINS_MONO) 35 | .with_default_font("JetBrains Mono") 36 | .with_window( 37 | WindowConfig::new(app) 38 | .with_size(1284.0, 724.0) 39 | .with_title("Rhyolite") 40 | .with_min_size(400.0, 300.0) 41 | .with_decorations(false) 42 | .with_transparency(true) 43 | .with_background("transparent") 44 | .with_icon(LaunchConfig::load_icon(APP_ICON)), 45 | ), 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "Rhyolite" 3 | version = "0.2.0" 4 | description = "A simple markdown editor written in Rust." 5 | authors = ["Suyog Tandel(RedddFoxxyy)"] 6 | license = "GPL-3.0" 7 | edition = "2024" 8 | 9 | [dependencies] 10 | freya = { git = "https://github.com/RedddFoxxyy/freya.git", branch = "feat/dynamic-scroll-view", features = [ 11 | ] } 12 | # freya = { path = "../freya/crates/freya", features = [] } 13 | dioxus-clipboard = "0.2.0" 14 | winit = "0.30.12" 15 | serde = { version = "1.0.228", features = ["derive"] } 16 | toml = "0.9.8" 17 | dirs = "6.0.0" 18 | #sanitize-filename = "0.6.0" 19 | log = { version = "0.4.28" } 20 | log4rs = "1.4.0" 21 | tokio = { version = "1.48.0", features = ["fs", "sync", "io-util", "io-std"] } 22 | slab = "0.4.11" 23 | #syntect = "5.2.0" 24 | 25 | [build-dependencies] 26 | dirs = "6.0.0" 27 | 28 | [profile.dev] 29 | incremental = true 30 | lto = false 31 | opt-level = 1 32 | codegen-units = 256 33 | 34 | [profile.release] 35 | codegen-units = 1 # Allows LLVM to perform better optimization. 36 | lto = true # Enables link-time-optimizations, however, is not stable. 37 | opt-level = 3 # Prioritizes speed. Use `z` if you prefer a small binary size. 38 | panic = "abort" # Higher performance by disabling panic handlers. 39 | strip = true # Ensures debug symbols are removed. 40 | 41 | [package.metadata.generate-rpm] 42 | name = "Rhyolite" 43 | assets = [ 44 | { source = "target/release/Rhyolite", dest = "/usr/bin/Rhyolite", mode = "0755" }, 45 | { source = "LICENSE.txt", dest = "/usr/share/doc/Rhyolite/LICENSE", doc = true, mode = "0644" }, 46 | { source = "packaging/linux/Rhyolite.desktop", dest = "/usr/share/applications/Rhyolite.desktop", mode = "0644" }, 47 | { source = "src/static/icon.png", dest = "/usr/share/icons/hicolor/512x512/apps/Rhyolite.png", mode = "0644" }, 48 | { source = "packaging/linux/Rhyolite.metainfo.xml", dest = "/usr/share/metainfo/Rhyolite.metainfo.xml", mode = "0644" }, 49 | ] 50 | -------------------------------------------------------------------------------- /src/view/dropdown.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use crate::data::stores::THEME_STORE; 17 | use freya::prelude::*; 18 | 19 | #[component] 20 | pub fn menu(children: Element) -> Element { 21 | let theme = THEME_STORE().current_theme.colors; 22 | 23 | rsx!( 24 | rect { 25 | position: "global", 26 | width: "205", 27 | height: "132", 28 | position_bottom: "10", 29 | position_left: "55", 30 | padding: "6 4", 31 | background: "{theme.base}", 32 | layer: "overlay", 33 | corner_radius: "12", 34 | rect { 35 | width: "fill", 36 | direction: "vertical", 37 | spacing: "6", 38 | 39 | {children} 40 | } 41 | }, 42 | ) 43 | } 44 | 45 | #[component] 46 | pub fn submenu(children: Element) -> Element { 47 | let theme = THEME_STORE().current_theme.colors; 48 | 49 | let scrollbar_theme = theme_with!(ScrollBarTheme { 50 | background: cow_borrowed!("transparent"), // 51 | thumb_background: Cow::from(theme.surface0.clone()), 52 | hover_thumb_background: Cow::from(theme.surface1.clone()), 53 | active_thumb_background: Cow::from(theme.surface2.clone()), 54 | }); 55 | 56 | rsx!( 57 | rect { 58 | position: "global", 59 | width: "220", 60 | height: "320", 61 | position_bottom: "10", 62 | position_left: "265", 63 | padding: "8 13 8 10", 64 | background: "{theme.base}", 65 | layer: "overlay", 66 | corner_radius: "12", 67 | ScrollView { 68 | width: "100%", 69 | direction: "vertical", 70 | spacing: "6", 71 | scrollbar_theme, 72 | {children} 73 | } 74 | } 75 | ) 76 | } 77 | -------------------------------------------------------------------------------- /src/static/svgs/settings.svg: -------------------------------------------------------------------------------- 1 | 15 | 16 | 37 | -------------------------------------------------------------------------------- /src/view/bottom_bar.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use crate::data::stores::{THEME_STORE, WORD_CHAR_COUNT}; 17 | use freya::prelude::*; 18 | 19 | #[component] 20 | pub fn bottom_floating_bar() -> Element { 21 | let theme = THEME_STORE().current_theme.colors; 22 | 23 | // let bar_width = 260; 24 | // let bar_height = 30; 25 | 26 | rsx!(rect { 27 | position: "absolute", 28 | position_bottom: "10", 29 | position_right: "10", 30 | width: "fill", 31 | height: "30", 32 | // main_align: "end", 33 | cross_align: "end", 34 | rect { 35 | width: "auto", 36 | height: "fill", 37 | background: theme.base, 38 | shadow: "4 4 8 1 rgb(0, 0, 0, 10)", 39 | corner_radius: "100", 40 | padding: "1", 41 | layer: "overlay", 42 | rect { 43 | height: "fill", 44 | width: "auto", 45 | direction: "horizontal", 46 | main_align: "space-between", 47 | cross_align: "center", 48 | padding: "2 10", 49 | word_count {}, 50 | char_count {} 51 | } 52 | } 53 | }) 54 | } 55 | 56 | fn word_count() -> Element { 57 | let theme = THEME_STORE().current_theme.colors; 58 | rsx!(rect { 59 | width: "auto", 60 | main_align: "center", 61 | label { 62 | color: theme.text, 63 | font_size: "15", 64 | font_family: "JetBrains Mono", 65 | "{ WORD_CHAR_COUNT().0 } Words " 66 | } 67 | }) 68 | } 69 | 70 | fn char_count() -> Element { 71 | let theme = THEME_STORE().current_theme.colors; 72 | rsx!(rect { 73 | width: "auto", 74 | main_align: "center", 75 | 76 | label { 77 | color: theme.text, 78 | font_size: "15", 79 | font_family: "JetBrains Mono", 80 | " { WORD_CHAR_COUNT().1 } Characters" 81 | } 82 | }) 83 | } 84 | -------------------------------------------------------------------------------- /src/data/types.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | //! # App State. 17 | //! Stores the current state and defines core skeleton of the app. 18 | //! 19 | //! All the required global statics/constants are declared in this module. 20 | 21 | use crate::data::themes::Theme; 22 | use freya::hooks::UseEditable; 23 | use serde::{Deserialize, Serialize}; 24 | use std::path::PathBuf; 25 | 26 | /// Name of the Default Note Title used by the app! 27 | pub const APP_DATA_DIR: &str = "rhyolite"; 28 | 29 | /// Name of the Default Note Title used by the app! 30 | pub const _USER_DATA_DIR: &str = "appdata"; 31 | 32 | pub const USER_DATA_FILE: &str = ".userdata.toml"; 33 | 34 | /// Name of the Default Trove used by the app! 35 | pub const DEFAULT_TROVE_DIR: &str = "Rhyolite Trove"; 36 | 37 | /// Name of the Default Note Title used by the app! 38 | pub const DEFAULT_NOTE_TITLE: &str = "Untitled"; 39 | 40 | #[derive(Clone, PartialEq)] 41 | pub struct MarkdownFile { 42 | pub path: PathBuf, 43 | pub title: String, 44 | pub editable: UseEditable, 45 | } 46 | 47 | /// Denotes a tab in the editor. 48 | #[derive(Debug, Serialize, Deserialize, Clone, Ord, PartialOrd, Eq, PartialEq)] 49 | pub struct Tab { 50 | // pub index: usize, // Unique identifier for the tab ( removed it for now ) 51 | pub title: String, // Title of the Document 52 | pub file_path: PathBuf, 53 | pub file_key: usize, // The reference to the document in the document vec. 54 | } 55 | 56 | #[allow(dead_code)] 57 | #[derive(Debug)] 58 | pub struct OpenFileData { 59 | pub title: String, 60 | pub contents: String, 61 | } 62 | 63 | ///Userdata Struct, used to store the userdata, like last open tab and all the open tabs. 64 | #[derive(Debug, Serialize, Deserialize, Clone, Default)] 65 | pub struct UserData { 66 | pub active_tabs: Vec, // Stores the list of last active tabs before the editor was closed 67 | pub last_open_tab: usize, // Stores the tab id of the last open tab 68 | pub recent_files: Vec, // Stores the list of recently created files 69 | pub current_theme: Theme, // Stores the current theme color palette 70 | } 71 | 72 | #[derive(Debug, Serialize, Deserialize, Clone)] 73 | pub struct RecentFileInfo { 74 | pub id: String, 75 | pub title: String, 76 | pub path: PathBuf, 77 | } 78 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | - Focusing on what is best for the community 15 | - Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | - Trolling, insulting/derogatory comments, and personal or political attacks 21 | - Public or private harassment 22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | - Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainers. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at 44 | 45 | For answers to common questions about this code of conduct, see 46 | -------------------------------------------------------------------------------- /src/view/widgets/buttons.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use crate::data::stores::THEME_STORE; 17 | use freya::prelude::*; 18 | 19 | #[derive(PartialEq, Clone)] 20 | pub enum _AnimationEasing { 21 | Linear, 22 | EaseIn, 23 | EaseOut, 24 | EaseInOut, 25 | Custom(f32), // For custom curves if supported 26 | } 27 | 28 | #[derive(PartialEq, Clone)] 29 | pub struct _TransitionConfig { 30 | pub from_color: String, 31 | pub to_color: String, 32 | pub duration: u64, 33 | // pub ease: AnimationEasing, 34 | // pub delay: u64, 35 | } 36 | impl Default for _TransitionConfig { 37 | fn default() -> Self { 38 | Self { 39 | from_color: "transparent".to_string(), 40 | to_color: "#surface1".to_string(), 41 | duration: 150, 42 | // ease: AnimationEasing::EaseOut, 43 | // delay: 0, 44 | } 45 | } 46 | } 47 | 48 | impl _TransitionConfig { 49 | pub fn _with_colors(mut self, from: String, to: String) -> Self { 50 | self.from_color = from; 51 | self.to_color = to; 52 | self 53 | } 54 | } 55 | 56 | #[derive(PartialEq, Clone, Props, Default)] 57 | pub struct DropDownButtonProps { 58 | #[props(default)] 59 | pub label: String, 60 | #[props(default = EventHandler::new(|_| {}))] 61 | pub onclick: EventHandler<()>, 62 | #[props(default = EventHandler::new(|_| {}))] 63 | pub onmouseenter: EventHandler<()>, 64 | #[props(default = EventHandler::new(|_| {}))] 65 | pub onmouseleave: EventHandler<()>, 66 | #[props(default)] 67 | pub icon: Option<&'static str>, 68 | } 69 | 70 | #[component] 71 | pub fn DropDownButton(props: DropDownButtonProps) -> Element { 72 | let theme = THEME_STORE().current_theme.colors; 73 | let mut hovered = use_signal(|| false); 74 | 75 | // &THEME_STORE().current_theme.colors.base, 76 | // &THEME_STORE().current_theme.colors.surface1, 77 | let animation = use_animation(move |_conf| { 78 | AnimColor::new( 79 | &THEME_STORE().current_theme.colors.base, 80 | &THEME_STORE().current_theme.colors.surface1, 81 | ) 82 | .time(150) 83 | }); 84 | 85 | let bg_color = &*animation.get().read_unchecked(); 86 | 87 | rsx!( 88 | CursorArea { 89 | icon: CursorIcon::Pointer, 90 | rect { 91 | width: "fill", 92 | height: "auto", 93 | background: "{bg_color.read()}", 94 | corner_radius: "10", 95 | padding: "5 6 5 6", 96 | direction: "horizontal", 97 | spacing: "5", 98 | onclick: move |_| props.onclick.call(()), 99 | onmouseenter: move |_| { 100 | hovered.set(true); 101 | animation.start(); 102 | props.onmouseenter.call(()); 103 | }, 104 | onmouseleave: move |_| { 105 | hovered.set(false); 106 | animation.reverse(); 107 | props.onmouseleave.call(()); 108 | }, 109 | 110 | if let Some(icon) = props.icon { 111 | rect { 112 | width: "20", 113 | height: "20", 114 | padding: "2", 115 | svg { 116 | width: "100%", 117 | height: "100%", 118 | stroke: "{ theme.text }", 119 | svg_content: icon 120 | } 121 | } 122 | } 123 | 124 | label { 125 | color:"{ theme.text }", 126 | font_size: "14", 127 | font_family: "JetBrains Mono", 128 | "{props.label}" 129 | } 130 | } 131 | } 132 | ) 133 | } 134 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Request for Changes / Pull Requests 4 | 5 | You first need to create a fork of the [rhyolite](https://github.com/RedddFoxxyy/rhyolite) repository to commit your 6 | changes to it. Methods to fork a repository can be found in 7 | the [GitHub Documentation](https://docs.github.com/en/get-started/quickstart/fork-a-repo). 8 | 9 | Then add your fork as a local project: 10 | 11 | ```sh 12 | git clone https://github.com/YOUR-USERNAME/rhyolite 13 | ``` 14 | 15 | > [Which remote URL should be used?](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories) 16 | 17 | Then, go to your local folder: 18 | 19 | ```sh 20 | cd rhyolite 21 | ``` 22 | 23 | Add git remote controls: 24 | 25 | ```sh 26 | git remote add fork https://github.com/YOUR-USERNAME/rhyolite 27 | git remote add upstream https://github.com/RedddFoxxyy/rhyolite 28 | ``` 29 | 30 | You can now verify that you have your two git remotes: 31 | 32 | ```sh 33 | git remote -v 34 | ``` 35 | 36 | ## Receive Remote Updates 37 | 38 | To stay up to date with the central repository: 39 | 40 | ```sh 41 | git pull upstream master 42 | ``` 43 | 44 | ## Choose a Base Branch 45 | 46 | Before starting development, you need to know which branch to base your modifications/additions on. When in doubt, use 47 | `master`. 48 | 49 | ### Branch Naming Convention 50 | 51 | When creating a new branch, use the following naming pattern based on the type of change: 52 | 53 | - **Features**: `feat/description` (e.g., `feat/file-saving`, `feat/user-authentication`) 54 | - **Bug fixes**: `fix/description` (e.g., `fix/memory-leak`, `fix/login-error`) 55 | - **Documentation**: `docs/description` (e.g., `docs/api-guide`, `docs/readme-update`) 56 | - **Refactoring**: `refactor/description` (e.g., `refactor/database-layer`) 57 | - **Performance**: `perf/description` (e.g., `perf/query-optimization`) 58 | - **Tests**: `test/description` (e.g., `test/user-service`) 59 | - **Chores**: `chore/description` (e.g., `chore/dependency-update`) 60 | 61 | ```sh 62 | # Switch to the desired branch 63 | git switch master 64 | # Pull down any upstream changes 65 | git pull upstream master 66 | # Create a new branch to work on (replace with appropriate prefix) 67 | git switch --create feat/your-feature-name 68 | ``` 69 | 70 | ## Submitting Your Pull Request 71 | 72 | 1. **Make your changes** and commit them to your branch 73 | 2. **Push your branch** to your fork: 74 | ```sh 75 | git push -u fork feat/your-feature-name 76 | ``` 77 | 3. **Create a draft pull request** on the [main rhyolite repository](https://github.com/RedddFoxxyy/rhyolite) targeting 78 | the `master` branch 79 | 4. **Mark as ready for review** when your changes are complete 80 | 5. **Request a review** from a maintainer 81 | 6. **Wait for approval** - a maintainer will review your changes and squash merge the PR when approved 82 | 83 | ### Pull Request Quality Guidelines 84 | 85 | **Do NOT submit low-quality pull requests such as:** 86 | 87 | - Simple name fixes or variable renaming 88 | - Grammar corrections in comments or documentation 89 | - Code style changes or formatting suggestions 90 | - Suggesting new coding standards or conventions 91 | 92 | **Use repository issues instead** for: 93 | 94 | - Reporting typos or grammar issues 95 | - Suggesting code style improvements 96 | - Proposing new coding conventions 97 | - Small documentation fixes 98 | 99 | **Good pull requests should:** 100 | 101 | - Add meaningful functionality or fix substantial bugs 102 | - Include tests for new features 103 | - Address existing issues from the issue tracker 104 | - Provide clear value to the project 105 | 106 | ## Code Style Guidelines 107 | 108 | Please follow these code style guidelines when contributing: 109 | 110 | ### Formatting 111 | 112 | - **Indentation**: Use tab indents with tab width set to 4 spaces 113 | - **Line Length**: Maximum line width of 140 characters 114 | - **Linting**: Follow Clippy linting rules - ensure your code passes `cargo clippy` without warnings 115 | 116 | ### Running Code Quality Checks 117 | 118 | Before submitting your pull request, make sure to run: 119 | 120 | ```sh 121 | # Format your code 122 | cargo fmt 123 | 124 | # Check for linting issues 125 | cargo clippy 126 | 127 | # Run tests 128 | cargo test 129 | ``` 130 | 131 | These guidelines help maintain consistent code quality and readability across the project. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | An Open Source and performant Markdown Editor and knowledge base! 6 | 7 |  8 |  9 | 10 | #### [Rhyolite](https://rhyolite.xyz/) is a simple markdown editor build using Rust with Freya that allows user to edit and work on markdown files. 11 | 12 | > Rhyolite is inspired by volcanic rock rhyolite, which is a type of igneous rock formed from the rapid cooling of lava. 13 | > 14 | > Rhyolite was a fork of [fextify](https://github.com/face-hh/fextify), but was later rewritten from scratch, 15 | > using sveltekit for the frontend and tauri version was changed from v1 to v2. As of now this project does not share any similarities to the [fextify](https://github.com/face-hh/fextify) project. 16 | > 17 | > Update: The project is now completely written in rust, and is being rewritten to use the [FREYA GUI](https://freyaui.dev/) library for the UI, making the app completely native code with rust. 18 | 19 | ## **Current Updates** 20 | 21 | - The app is being migrated from Tauri(Svelte) to Freya(Rust) based UI.(WIP). 22 | - The [0.1.10-freeze](https://github.com/RedddFoxxyy/rhyolite/tree/0.1.10-freeze) branch has the old code for the old tauri version of the app which will not be maintained anymore. 23 | 24 | 25 | ## **For New Contributors** 26 | 27 | 1. If you want to contribute to the app, you can work on any of the issues that have not been assigned to anyone. 28 | 2. Join our **[Discord server](https://discord.gg/K6FAd8FTma)** to collaborate effectively. 29 | 3. Checkout the master Branch for latest commits to the app. 30 | 31 | 32 | ## How to Install? 33 | 34 | ### **Windows** 35 | 36 | - Use the `Rhyolite_[version]_[cpu architecture]_en-US.msi` or `Rhyolite_[version]_[cpu architecture]-setup.exe` installer from the [Releases section](https://github.com/RedddFoxxyy/Rhyolite/releases) or from the [official website](https://rhyolite.xyz/). 37 | 38 | 39 | ### **MacOS** 40 | 41 | - Use the `Rhyolite_[version]_[cpu architecture].dmg` for Intel Macs from the [Releases section](https://github.com/RedddFoxxyy/Rhyolite/releases) or from the [official website](https://rhyolite.xyz/). 42 | 43 | > **Note:** You may encounter issues since the app isn’t signed yet, like macos saying dmg is damaged. 44 | 45 | 46 | ### **Linux** 47 | 48 | #### Universal Linux Installer ( Use this if you use a rolling release distro or latest LTS distro ) 49 | 50 | Run this command in your terminal: 51 | 52 | ```bash 53 | curl -f https://rhyolite.xyz/install.sh | sh 54 | ``` 55 | 56 | To Uninstall: 57 | 58 | ```bash 59 | curl -f https://rhyolite.xyz/uninstall.sh | sh 60 | ``` 61 | 62 | #### Debian/Ubuntu 63 | 64 | - Install the .deb package from the Releases section. 65 | 66 | #### RHEL/Fedora 67 | 68 | - Install the .rpm package from the same section. 69 | 70 | #### AppImage/Raw Binary 71 | 72 | Install `Rhyolite_[version]_.AppImage` using [Gear Lever](https://github.com/mijorus/gearlever) or [AppImageLauncher](https://github.com/TheAssassin/AppImageLauncher), you can also make it executable and run it directly. 73 | 74 | #### Flatpak 75 | 76 | > Work In Progress! 77 | 78 | 79 | ### **Manual Compilation** 80 | 81 | - Linux/macOS users make sure you have rustc, ld/lld/mold, and gcc/clang installed. 82 | - Windows users make sure you have msvc and rustc installed. 83 | 84 | - Fedora/Nobara Linux users, install the following dependencies: 85 | 86 | ```bash 87 | sudo dnf install freetype-devel fontconfig-devel mesa-libGL-devel mesa-libEGL-devel mesa-libGLES-devel wayland-devel 88 | ``` 89 | 90 | - Clone the repo and checkout release branch. 91 | 92 | - To build the app manually, run: 93 | 94 | ```bash 95 | cargo build --release 96 | ``` 97 | 98 | 99 | ## Known Bugs 100 | 101 | 1. Theming might cause visibility issues. 102 | 2. Tab icons occasionally glitch. 103 | 3. Large numbers of open tabs can distort the title. 104 | 4. The app is still alpha so many unkown/unregisterd bugs. 105 | 106 | ## Licensing 107 | 108 | This project is licensed under the terms of the GPL-3.0 open source license. Please refer to [GPL-3.0](./LICENSE.txt) for the full terms. 109 | 110 | ``` 111 | Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 112 | 113 | This program is free software: you can redistribute it and/or modify 114 | it under the terms of the GNU General Public License as published by 115 | the Free Software Foundation, either version 3 of the License, or 116 | (at your option) any later version. 117 | 118 | This program is distributed in the hope that it will be useful, 119 | but WITHOUT ANY WARRANTY; without even the implied warranty of 120 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 121 | GNU General Public License for more details. 122 | 123 | You should have received a copy of the GNU General Public License 124 | along with this program. If not, see . 125 | ``` 126 | 127 | ## Maintainers 128 | 129 | [@RedddFoxxyy](https://github.com/RedddFoxxyy) 130 | 131 | ## Thanks to all the contributers!! 132 | 133 | - This project would have not been possible without the initial guidance and help of [@80avin](https://github.com/80avin), [@RaphGL](https://github.com/RaphGL) and [@prettyblueberry](https://github.com/prettyblueberry). 134 | - Thanks to [marc2332](https://github.com/marc2332) for building [Freya](https://github.com/marc2332/freya) and helping me with using it for rhyolite 135 | -------------------------------------------------------------------------------- /.github/workflows/nightly_release.yml: -------------------------------------------------------------------------------- 1 | name: "publish-nightly" 2 | on: 3 | push: 4 | branches: 5 | - nightly 6 | # paths: 7 | # - 'packaging/build.md' 8 | 9 | jobs: 10 | publish-tauri: 11 | permissions: 12 | contents: write # Ensure this is present 13 | issues: write # Optional but recommended 14 | pull-requests: write # Optional but recommended 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | include: 19 | - platform: "macos-latest" # for Arm based macs (M1 and above) 20 | args: "--target aarch64-apple-darwin" 21 | - platform: "macos-latest" # for Intel based macs 22 | args: "--target x86_64-apple-darwin" 23 | - platform: "ubuntu-22.04" 24 | args: "" 25 | - platform: "ubuntu-24.04-arm" # New ARM64 Linux runner 26 | args: "--target aarch64-unknown-linux-gnu" 27 | - platform: "windows-latest" # Windows x64 28 | args: "--target x86_64-pc-windows-msvc" 29 | - platform: "windows-latest" # Windows x86 (32-bit) 30 | args: "--target i686-pc-windows-msvc" 31 | - platform: "windows-latest" # Windows ARM64 32 | args: "--target aarch64-pc-windows-msvc" 33 | 34 | runs-on: ${{ matrix.platform }} 35 | steps: 36 | - uses: actions/checkout@v4 37 | 38 | - name: setup node 39 | uses: actions/setup-node@v4 40 | with: 41 | node-version: lts/* 42 | 43 | - name: install Rust stable 44 | uses: dtolnay/rust-toolchain@stable 45 | with: 46 | targets: > 47 | ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || 48 | matrix.platform == 'windows-latest' && 'x86_64-pc-windows-msvc,i686-pc-windows-msvc,aarch64-pc-windows-msvc' || '' }} 49 | 50 | - name: install dependencies (ubuntu only) 51 | if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' 52 | run: | 53 | sudo apt-get update 54 | sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf 55 | 56 | - name: install dependencies (ubuntu-arm64 only) 57 | if: matrix.platform == 'ubuntu-24.04-arm' 58 | run: | 59 | sudo apt-get install xdg-utils 60 | 61 | - name: install frontend dependencies 62 | run: npm install 63 | 64 | - name: Extract version from Cargo.toml 65 | id: get_version 66 | shell: bash 67 | run: | 68 | # Define the path to your Cargo.toml file 69 | cargo_file="src-tauri/Cargo.toml" 70 | # Extract ONLY the version number using a more precise regex 71 | version=$(grep -m 1 '^version' "$cargo_file" | sed -E 's/.*"([0-9]+\.[0-9]+\.[0-9]+)".*/\1/') 72 | # Output for debugging 73 | echo "Version found: $version" 74 | # Set the output correctly for GitHub Actions 75 | echo "version=$version" >> $GITHUB_ENV 76 | 77 | - name: Create Git tag 78 | run: | 79 | git tag v${{ env.version }} 80 | git push origin v${{ env.version }} 81 | 82 | # Step 1: Generate auto-generated changelog (using a community Action) 83 | - name: Generate Changelog 84 | id: changelog 85 | uses: requarks/changelog-action@v1 86 | with: 87 | token: ${{ secrets.GITHUB_TOKEN }} 88 | tag: v${{ env.version }} 89 | 90 | # Step 2: Generate "What's Changed" block from commits 91 | # - name: Generate "What's Changed" block 92 | # id: whats_changed 93 | # shell: bash 94 | # run: | 95 | # # Get commit messages between the last tag and HEAD, or use all commits if no tags exist 96 | # if git describe --tags --abbrev=0 >/dev/null 2>&1; then 97 | # commits=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s") 98 | # else 99 | # commits=$(git log --pretty=format:"- %s") 100 | # fi 101 | 102 | # # Format for GitHub Actions output in a cross-platform way 103 | # { 104 | # echo "whats_changed<> $GITHUB_OUTPUT 108 | 109 | # Step 3: Publish the release with combined release body 110 | - uses: tauri-apps/tauri-action@v0 111 | env: 112 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 113 | with: 114 | tagName: v__VERSION__ 115 | releaseName: "Rhyolite(v__VERSION__) NIGHTLY" 116 | releaseBody: | 117 | # Rhyolite app(v__VERSION__) nightly release. 118 | 119 | ## Caution: 120 | - This is a nightly release and thus has a lot of bugs. 121 | - Only nightly builds follow a rolling release pattern. 122 | 123 | ## Auto-generated Changelog: 124 | ${{ steps.changelog.outputs.changes }} 125 | 126 | releaseDraft: false 127 | prerelease: true 128 | args: ${{ matrix.args }} 129 | -------------------------------------------------------------------------------- /.github/workflows/stable_release.yml: -------------------------------------------------------------------------------- 1 | name: "publish-stable" 2 | on: 3 | push: 4 | branches: 5 | - release 6 | # paths: 7 | # - 'packaging/build.md' 8 | 9 | jobs: 10 | publish-tauri: 11 | permissions: 12 | contents: write # Ensure this is present 13 | issues: write # Optional but recommended 14 | pull-requests: write # Optional but recommended 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | include: 19 | - platform: "macos-latest" # for Arm based macs (M1 and above) 20 | args: "--target aarch64-apple-darwin" 21 | - platform: "macos-latest" # for Intel based macs 22 | args: "--target x86_64-apple-darwin" 23 | - platform: "ubuntu-22.04" 24 | args: "" 25 | - platform: "ubuntu-24.04-arm" # New ARM64 Linux runner 26 | args: "--target aarch64-unknown-linux-gnu" 27 | - platform: "windows-latest" # Windows x64 28 | args: "--target x86_64-pc-windows-msvc" 29 | - platform: "windows-latest" # Windows x86 (32-bit) 30 | args: "--target i686-pc-windows-msvc" 31 | - platform: "windows-latest" # Windows ARM64 32 | args: "--target aarch64-pc-windows-msvc" 33 | 34 | runs-on: ${{ matrix.platform }} 35 | steps: 36 | - uses: actions/checkout@v4 37 | 38 | - name: setup node 39 | uses: actions/setup-node@v4 40 | with: 41 | node-version: lts/* 42 | 43 | - name: install Rust stable 44 | uses: dtolnay/rust-toolchain@stable 45 | with: 46 | targets: > 47 | ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || 48 | matrix.platform == 'windows-latest' && 'x86_64-pc-windows-msvc,i686-pc-windows-msvc,aarch64-pc-windows-msvc' || '' }} 49 | 50 | - name: install dependencies (ubuntu only) 51 | if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm' 52 | run: | 53 | sudo apt-get update 54 | sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf 55 | 56 | - name: install dependencies (ubuntu-arm64 only) 57 | if: matrix.platform == 'ubuntu-24.04-arm' 58 | run: | 59 | sudo apt-get install xdg-utils 60 | 61 | - name: install frontend dependencies 62 | run: npm install 63 | 64 | - name: Extract version from Cargo.toml 65 | id: get_version 66 | shell: bash 67 | run: | 68 | # Define the path to your Cargo.toml file 69 | cargo_file="src-tauri/Cargo.toml" 70 | # Extract ONLY the version number using a more precise regex 71 | version=$(grep -m 1 '^version' "$cargo_file" | sed -E 's/.*"([0-9]+\.[0-9]+\.[0-9]+)".*/\1/') 72 | # Output for debugging 73 | echo "Version found: $version" 74 | # Set the output correctly for GitHub Actions 75 | echo "version=$version" >> $GITHUB_ENV 76 | 77 | - name: Create Git tag 78 | run: | 79 | git tag v${{ env.version }} 80 | git push origin v${{ env.version }} 81 | 82 | # Step 1: Generate auto-generated changelog (using a community Action) 83 | - name: Generate Changelog 84 | id: changelog 85 | uses: requarks/changelog-action@v1 86 | with: 87 | token: ${{ secrets.GITHUB_TOKEN }} 88 | tag: v${{ env.version }} 89 | 90 | # Step 2: Generate "What's Changed" block from commits 91 | - name: Generate "What's Changed" block 92 | id: whats_changed 93 | shell: bash 94 | run: | 95 | # Get commit messages between the last tag and HEAD, or use all commits if no tags exist 96 | if git describe --tags --abbrev=0 >/dev/null 2>&1; then 97 | commits=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s") 98 | else 99 | commits=$(git log --pretty=format:"- %s") 100 | fi 101 | 102 | # Format for GitHub Actions output in a cross-platform way 103 | { 104 | echo "whats_changed<> $GITHUB_OUTPUT 108 | 109 | # Step 3: Publish the release with combined release body 110 | - uses: tauri-apps/tauri-action@v0 111 | env: 112 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 113 | with: 114 | tagName: v__VERSION__ 115 | releaseName: "Rhyolite(v__VERSION__) ALPHA" 116 | releaseBody: | 117 | # Rhyolite app(v__VERSION__) Alpha release. 118 | 119 | ## Caution: 120 | - This is an alpha release and thus can have some bugs. 121 | 122 | ## What's Changed: 123 | ${{ steps.whats_changed.outputs.whats_changed }} 124 | 125 | ## Auto-generated Changelog: 126 | ${{ steps.changelog.outputs.changes }} 127 | 128 | releaseDraft: false 129 | prerelease: false 130 | args: ${{ matrix.args }} 131 | -------------------------------------------------------------------------------- /src/data/themes.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use crate::data::types::APP_DATA_DIR; 17 | use serde::{Deserialize, Serialize}; 18 | use std::fs; 19 | use std::path::PathBuf; 20 | 21 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 22 | pub struct ThemesStore { 23 | pub themes_dir: PathBuf, 24 | pub themes_list: Vec<(String, PathBuf)>, 25 | pub current_theme: Theme, 26 | } 27 | impl ThemesStore { 28 | // TODO: Make this as new function and make a new default function. 29 | pub fn init() -> ThemesStore { 30 | let themes_dir = { 31 | let Some(data) = dirs::state_dir() else { 32 | eprintln!("No Data directory could be found/accessed!"); 33 | panic!("Failed to find Data directory.") 34 | }; 35 | let app_data_dir = data.join(APP_DATA_DIR); 36 | 37 | let themes_dir = app_data_dir.join("Themes"); 38 | 39 | if let Err(e) = fs::create_dir_all(&themes_dir) { 40 | eprintln!("Failed to create App Themes directory: {}", e); 41 | }; 42 | 43 | themes_dir 44 | }; 45 | 46 | let themes_list_result = list_toml_names(&themes_dir); 47 | 48 | if let Err(e) = themes_list_result { 49 | log::error!("Failed to list themes in directory: {}", e); 50 | log::warn!("Using default theme."); 51 | log::warn!("No themes to select from.."); 52 | return ThemesStore { 53 | themes_dir, 54 | themes_list: vec![], 55 | current_theme: Theme::default(), 56 | }; 57 | } 58 | 59 | ThemesStore { 60 | themes_dir, 61 | themes_list: themes_list_result.unwrap(), 62 | current_theme: Theme::default(), 63 | } 64 | } 65 | 66 | pub async fn change_current_theme(&mut self, theme_path: PathBuf) { 67 | if let Some(theme) = self.load_theme_from_file(theme_path) { 68 | self.current_theme = theme.clone(); 69 | } else { 70 | log::error!("The given theme does not exists or is corrupted."); 71 | } 72 | } 73 | 74 | // pub async fn _preview_theme(&mut self, preview: bool, theme_index: usize, original_theme: &Option) { 75 | // if preview { 76 | // if original_theme.is_none() { 77 | // // This is the first preview, store current and switch to preview 78 | // self.current_theme = self.themes_path.get(theme_index).unwrap().clone(); 79 | // } else { 80 | // // Already previewing, just switch to new preview theme 81 | // self.current_theme = self.themes_path.get(theme_index).unwrap().clone(); 82 | // } 83 | // } else { 84 | // // Restore original theme 85 | // if let Some(original) = original_theme { 86 | // self.current_theme = original.clone(); 87 | // } 88 | // } 89 | // } 90 | 91 | // TODO: Handle errors. 92 | fn load_theme_from_file(&self, path: PathBuf) -> Option { 93 | let theme_content = fs::read_to_string(path).unwrap_or_default(); 94 | toml::from_str(&theme_content).ok() 95 | } 96 | } 97 | 98 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 99 | pub struct Theme { 100 | pub info: ThemeInfo, 101 | pub colors: Colors, 102 | } 103 | 104 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 105 | pub struct ThemeInfo { 106 | pub name: String, 107 | pub author: String, 108 | pub themetype: ThemeType, 109 | pub colorscheme: ColorScheme, 110 | } 111 | 112 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 113 | pub enum ThemeType { 114 | #[default] 115 | Basic, 116 | Advance, 117 | } 118 | 119 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 120 | pub enum ColorScheme { 121 | Light, 122 | #[default] 123 | Dark, 124 | } 125 | 126 | #[derive(Serialize, Deserialize, Clone, Debug, Default)] 127 | pub struct Colors { 128 | pub text: String, 129 | pub subtext2: String, 130 | pub subtext1: String, 131 | pub subtext0: String, 132 | pub overlay2: String, 133 | pub overlay1: String, 134 | pub overlay0: String, 135 | pub surface2: String, 136 | pub surface1: String, 137 | pub surface0: String, 138 | pub base: String, 139 | pub crust: String, 140 | pub mantle: String, 141 | pub accent: String, 142 | pub highlight: String, 143 | pub border: String, 144 | } 145 | 146 | #[allow(dead_code)] 147 | #[derive(Serialize, Deserialize, Clone, Debug)] 148 | pub struct ThemeListItem { 149 | pub filename: String, 150 | pub name: String, 151 | } 152 | 153 | impl Theme { 154 | pub fn default() -> Theme { 155 | Theme { 156 | info: ThemeInfo { 157 | name: "Default".to_string(), 158 | author: "Rhyolite Team".to_string(), 159 | themetype: ThemeType::Basic, 160 | colorscheme: ColorScheme::Dark, 161 | }, 162 | colors: Colors { 163 | text: "#ffffff".to_string(), 164 | subtext2: "#f1f2f3".to_string(), 165 | subtext1: "#d8dbde".to_string(), 166 | subtext0: "#c2c6cb".to_string(), 167 | overlay2: "#acb2b8".to_string(), 168 | overlay1: "#969da5".to_string(), 169 | overlay0: "#808992".to_string(), 170 | surface2: "#6c757d".to_string(), 171 | surface1: "#596167".to_string(), 172 | surface0: "#464c51".to_string(), 173 | base: "#33373b".to_string(), 174 | crust: "#202325".to_string(), 175 | mantle: "#0d0e0f".to_string(), 176 | accent: "#ff4081".to_string(), 177 | highlight: "#ffa726".to_string(), 178 | border: "#424242".to_string(), 179 | }, 180 | } 181 | } 182 | } 183 | 184 | fn list_toml_names(dir: &PathBuf) -> std::io::Result> { 185 | let mut names = Vec::new(); 186 | 187 | for entry in fs::read_dir(dir)? { 188 | let entry = entry?; 189 | let path = entry.path(); 190 | 191 | if path.extension().and_then(|e| e.to_str()) == Some("toml") { 192 | let theme = fs::read_to_string(&path).unwrap_or_default(); 193 | if let Ok(theme) = toml::from_str::(&theme) { 194 | let theme_name = theme.info.name; 195 | names.push((theme_name, path)); 196 | } else { 197 | log::error!("{path:?} is not a theme file!") 198 | } 199 | } 200 | } 201 | names.sort_by_key(|a| a.0.to_lowercase()); 202 | 203 | Ok(names) 204 | } 205 | -------------------------------------------------------------------------------- /src/view/sidebar.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | use crate::data::stores::{ 17 | SHOW_SETTINGS_DROPUP, SHOW_THEMES_DROPUP, THEME_STORE, toggle_command_palette, toggle_recent_files, toggle_settings_dropup, 18 | toggle_themes_dropup, 19 | }; 20 | use crate::view::dropdown; 21 | use crate::view::widgets::buttons; 22 | use freya::prelude::*; 23 | 24 | #[component] 25 | pub fn side_bar() -> Element { 26 | let theme = THEME_STORE().current_theme.colors; 27 | let themes_list = THEME_STORE().themes_list; 28 | let platform = use_platform(); 29 | 30 | let settings_list: [buttons::DropDownButtonProps; 4] = [ 31 | buttons::DropDownButtonProps { 32 | label: "General Settings".to_string(), 33 | onclick: EventHandler::new(move |_| { 34 | platform.new_window( 35 | WindowConfig::new_with_props(settings_window, settings_windowProps { value: 404 }).with_title("Rhyolite Settings"), 36 | ) 37 | }), 38 | icon: Some(include_str!("../static/svgs/sliders-horizontal.svg")), 39 | ..Default::default() 40 | }, 41 | buttons::DropDownButtonProps { 42 | label: "Theme".to_string(), 43 | onclick: EventHandler::new(|_| { 44 | toggle_themes_dropup(); 45 | }), 46 | icon: Some(include_str!("../static/svgs/palette.svg")), 47 | ..Default::default() 48 | }, 49 | buttons::DropDownButtonProps { 50 | label: "Keyboard Shortcuts".to_string(), 51 | onclick: EventHandler::new(|_| {}), 52 | icon: Some(include_str!("../static/svgs/keyboard.svg")), 53 | ..Default::default() 54 | }, 55 | buttons::DropDownButtonProps { 56 | label: "About".to_string(), 57 | onclick: EventHandler::new(|_| {}), 58 | icon: Some(include_str!("../static/svgs/info.svg")), 59 | ..Default::default() 60 | }, 61 | ]; 62 | 63 | rsx!(rect { 64 | width: "50", 65 | height: "fill", 66 | background: "transparent", 67 | border: "0 2 0 0 outer { theme.surface0 }", 68 | side_bar_buttons{}, 69 | if SHOW_SETTINGS_DROPUP() { 70 | dropdown::menu { 71 | rect { 72 | for setting in settings_list { 73 | buttons::DropDownButton{..setting} 74 | } 75 | } 76 | } 77 | if SHOW_THEMES_DROPUP() { 78 | dropdown::submenu { 79 | for theme in themes_list { 80 | buttons::DropDownButton { 81 | label: &theme.0, 82 | onclick: EventHandler::new({ 83 | let theme = theme.clone(); 84 | move |_| { 85 | let theme_path = theme.1.clone(); 86 | spawn(async move { 87 | THEME_STORE.write().change_current_theme(theme_path).await; 88 | }); 89 | } 90 | }), 91 | } 92 | } 93 | } 94 | } 95 | } 96 | }) 97 | } 98 | 99 | #[component] 100 | fn side_bar_buttons() -> Element { 101 | rsx!(rect { 102 | direction: "vertical", 103 | width: "100%", 104 | height: "100%", 105 | main_align: "space-between", 106 | top_buttons { }, 107 | bottom_buttons { } 108 | }) 109 | } 110 | 111 | #[component] 112 | fn top_buttons() -> Element { 113 | let theme = THEME_STORE().current_theme.colors; 114 | 115 | rsx!(rect { 116 | direction: "vertical", 117 | width: "100%", 118 | height: "auto", 119 | spacing: "1", 120 | margin: "5 0 0 0", 121 | 122 | // Command Palette Toggle Button 123 | sidebar_button { 124 | on_click: move |_| toggle_command_palette(), 125 | svg { 126 | width: "100%", 127 | height: "100%", 128 | stroke: "{ theme.surface2 }", 129 | svg_content: include_str!("../static/svgs/command_palette.svg") 130 | } 131 | }, 132 | 133 | // Recent Files Toggle Button 134 | sidebar_button { 135 | on_click: move |_| toggle_recent_files(), 136 | svg { 137 | width: "100%", 138 | height: "100%", 139 | stroke: "{ theme.surface2 }", 140 | svg_content: include_str!("../static/svgs/recent_files.svg") 141 | } 142 | } 143 | }) 144 | } 145 | 146 | #[component] 147 | fn bottom_buttons() -> Element { 148 | let theme = THEME_STORE().current_theme.colors; 149 | 150 | rsx!(rect { 151 | direction: "vertical", 152 | width: "100%", 153 | height: "auto", 154 | spacing: "1", 155 | margin: "0 0 6 0", 156 | 157 | // Settings Toggle Button 158 | sidebar_button { 159 | on_click: toggle_settings_dropup, 160 | svg { 161 | width: "100%", 162 | height: "100%", 163 | stroke: "{ theme.surface2 }", 164 | svg_content: include_str!("../static/svgs/settings.svg") 165 | } 166 | }, 167 | }) 168 | } 169 | 170 | #[component] 171 | fn sidebar_button(on_click: EventHandler<()>, children: Element) -> Element { 172 | // Transition state with duration of 150ms 173 | // 174 | // NOTE: Instead of using a hovered signal, we might hard code it 175 | // into the on_mouse_enter and on_mouse_leave closures. 176 | let animation = use_animation(move |_conf| { 177 | ( 178 | AnimColor::new("transparent", &THEME_STORE().current_theme.colors.surface2).time(150), 179 | AnimNum::new(0.0, 0.2).time(150), 180 | ) 181 | }); 182 | 183 | let (bg_color, hover_opacity) = &*animation.get().read_unchecked(); 184 | 185 | rsx!( 186 | CursorArea { 187 | icon: CursorIcon::Pointer, 188 | rect { 189 | width: "100%", 190 | height: "40", 191 | padding: "2 6", 192 | main_align: "center", 193 | cross_align: "center", 194 | rect { 195 | background: "{bg_color.read()}", 196 | width: "100%", 197 | height: "100%", 198 | padding: "1.3", 199 | main_align: "center", 200 | cross_align: "center", 201 | background_opacity:"{hover_opacity.read()}", 202 | corner_radius: "8", 203 | onclick: move |_| on_click.call(()), 204 | onmouseenter: move |_| animation.start(), 205 | onmouseleave: move |_| animation.reverse(), 206 | {children} 207 | } 208 | } 209 | } 210 | 211 | ) 212 | } 213 | 214 | // TODO: Move this into its own component. 215 | #[component] 216 | fn settings_window(value: i32) -> Element { 217 | let platform = use_platform(); 218 | let theme = THEME_STORE().current_theme.colors; 219 | 220 | let onpress = move |_| platform.close_window(); 221 | 222 | rsx!( 223 | rect { 224 | height: "100%", 225 | width: "100%", 226 | main_align: "center", 227 | cross_align: "center", 228 | background: theme.crust, 229 | font_size: "30", 230 | label { 231 | color: theme.text, 232 | "{value}: Yet to be Implemented." 233 | } 234 | Button { 235 | onpress, 236 | label { "Close" } 237 | } 238 | } 239 | ) 240 | } 241 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # === Windows === 2 | 3 | # Windows thumbnail cache files 4 | Thumbs.db 5 | Thumbs.db:encryptable 6 | ehthumbs.db 7 | ehthumbs_vista.db 8 | 9 | # Dump file 10 | *.stackdump 11 | 12 | # Folder config file 13 | [Dd]esktop.ini 14 | 15 | # Recycle Bin used on file shares 16 | $RECYCLE.BIN/ 17 | 18 | # Windows Installer files 19 | *.cab 20 | *.msi 21 | *.msix 22 | *.msm 23 | *.msp 24 | 25 | # Windows shortcuts 26 | *.lnk 27 | 28 | # === MacOS === 29 | 30 | # General 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Icon must end with two \r 36 | Icon␍␍ 37 | 38 | # Thumbnails 39 | ._* 40 | 41 | # Files that might appear in the root of a volume 42 | .DocumentRevisions-V100 43 | .fseventsd 44 | .Spotlight-V100 45 | .TemporaryItems 46 | .Trashes 47 | .VolumeIcon.icns 48 | .com.apple.timemachine.donotpresent 49 | 50 | # Directories potentially created on remote AFP share 51 | .AppleDB 52 | .AppleDesktop 53 | Network Trash Folder 54 | Temporary Items 55 | .apdisk 56 | 57 | # Logs 58 | logs 59 | *.log 60 | npm-debug.log* 61 | yarn-debug.log* 62 | yarn-error.log* 63 | lerna-debug.log* 64 | .pnpm-debug.log* 65 | 66 | # Diagnostic reports (https://nodejs.org/api/report.html) 67 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 68 | 69 | # Runtime data 70 | pids 71 | *.pid 72 | *.seed 73 | *.pid.lock 74 | 75 | # Directory for instrumented libs generated by jscoverage/JSCover 76 | lib-cov 77 | 78 | # Coverage directory used by tools like istanbul 79 | coverage 80 | *.lcov 81 | 82 | # nyc test coverage 83 | .nyc_output 84 | 85 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 86 | .grunt 87 | 88 | # Bower dependency directory (https://bower.io/) 89 | bower_components 90 | 91 | # node-waf configuration 92 | .lock-wscript 93 | 94 | # Compiled binary addons (https://nodejs.org/api/addons.html) 95 | build/Release 96 | 97 | # Dependency directories 98 | node_modules/ 99 | jspm_packages/ 100 | 101 | # Snowpack dependency directory (https://snowpack.dev/) 102 | web_modules/ 103 | 104 | # TypeScript cache 105 | *.tsbuildinfo 106 | 107 | # Optional npm cache directory 108 | .npm 109 | 110 | # Optional eslint cache 111 | .eslintcache 112 | 113 | # Optional stylelint cache 114 | .stylelintcache 115 | 116 | # Microbundle cache 117 | .rpt2_cache/ 118 | .rts2_cache_cjs/ 119 | .rts2_cache_es/ 120 | .rts2_cache_umd/ 121 | 122 | # Optional REPL history 123 | .node_repl_history 124 | 125 | # Output of 'npm pack' 126 | *.tgz 127 | 128 | # Yarn Integrity file 129 | .yarn-integrity 130 | 131 | # dotenv environment variable files 132 | .env 133 | .env.development.local 134 | .env.test.local 135 | .env.production.local 136 | .env.local 137 | 138 | # parcel-bundler cache (https://parceljs.org/) 139 | .cache 140 | .parcel-cache 141 | 142 | # Next.js build output 143 | .next 144 | out 145 | 146 | # vitepress build output 147 | **/.vitepress/dist 148 | 149 | # vitepress cache directory 150 | **/.vitepress/cache 151 | 152 | # Docusaurus cache and generated files 153 | .docusaurus 154 | 155 | # Serverless directories 156 | .serverless/ 157 | 158 | # FuseBox cache 159 | .fusebox/ 160 | 161 | # DynamoDB Local files 162 | .dynamodb/ 163 | 164 | # TernJS port file 165 | .tern-port 166 | 167 | # Stores VSCode versions used for testing VSCode extensions 168 | .vscode-test 169 | 170 | # yarn v2 171 | .yarn/cache 172 | .yarn/unplugged 173 | .yarn/build-state.yml 174 | .yarn/install-state.gz 175 | .pnp.* 176 | 177 | # === Cargo === 178 | 179 | # will have compiled files and executables 180 | debug/ 181 | target/ 182 | 183 | # These are backup files generated by rustfmt 184 | **/*.rs.bk 185 | 186 | # MSVC Windows builds of rustc generate these, which store debugging information 187 | *.pdb 188 | 189 | # RustRover 190 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 191 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 192 | # and can be added to the global gitignore or merged into this file. For a more nuclear 193 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 194 | #.idea/ 195 | 196 | # === Node === 197 | 198 | .svelte-kit/ 199 | 200 | # Logs 201 | logs 202 | *.log 203 | npm-debug.log* 204 | yarn-debug.log* 205 | yarn-error.log* 206 | lerna-debug.log* 207 | .pnpm-debug.log* 208 | 209 | # Diagnostic reports (https://nodejs.org/api/report.html) 210 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 211 | 212 | # Runtime data 213 | pids 214 | *.pid 215 | *.seed 216 | *.pid.lock 217 | 218 | # Directory for instrumented libs generated by jscoverage/JSCover 219 | lib-cov 220 | 221 | # Coverage directory used by tools like istanbul 222 | coverage 223 | *.lcov 224 | 225 | # nyc test coverage 226 | .nyc_output 227 | 228 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 229 | .grunt 230 | 231 | # Bower dependency directory (https://bower.io/) 232 | bower_components 233 | 234 | # node-waf configuration 235 | .lock-wscript 236 | 237 | # Compiled binary addons (https://nodejs.org/api/addons.html) 238 | build/Release 239 | 240 | # Dependency directories 241 | node_modules/ 242 | jspm_packages/ 243 | 244 | # Snowpack dependency directory (https://snowpack.dev/) 245 | web_modules/ 246 | 247 | # TypeScript cache 248 | *.tsbuildinfo 249 | 250 | # Optional npm cache directory 251 | .npm 252 | 253 | # Optional eslint cache 254 | .eslintcache 255 | 256 | # Optional stylelint cache 257 | .stylelintcache 258 | 259 | # Microbundle cache 260 | .rpt2_cache/ 261 | .rts2_cache_cjs/ 262 | .rts2_cache_es/ 263 | .rts2_cache_umd/ 264 | 265 | # Optional REPL history 266 | .node_repl_history 267 | 268 | # Output of 'npm pack' 269 | *.tgz 270 | 271 | # Yarn Integrity file 272 | .yarn-integrity 273 | 274 | # dotenv environment variable files 275 | .env 276 | .env.development.local 277 | .env.test.local 278 | .env.production.local 279 | .env.local 280 | 281 | # parcel-bundler cache (https://parceljs.org/) 282 | .cache 283 | .parcel-cache 284 | 285 | # vitepress build output 286 | **/.vitepress/dist 287 | 288 | # vitepress cache directory 289 | **/.vitepress/cache 290 | 291 | # Docusaurus cache and generated files 292 | .docusaurus 293 | 294 | # Serverless directories 295 | .serverless/ 296 | 297 | # FuseBox cache 298 | .fusebox/ 299 | 300 | # DynamoDB Local files 301 | .dynamodb/ 302 | 303 | # TernJS port file 304 | .tern-port 305 | 306 | # Stores VSCode versions used for testing VSCode extensions 307 | .vscode-test 308 | 309 | # yarn v2 310 | .yarn/cache 311 | .yarn/unplugged 312 | .yarn/build-state.yml 313 | .yarn/install-state.gz 314 | .pnp.* 315 | 316 | # === VSCode === 317 | 318 | .vscode/* 319 | !.vscode/settings.json 320 | !.vscode/tasks.json 321 | !.vscode/launch.json 322 | !.vscode/extensions.json 323 | !.vscode/*.code-snippets 324 | 325 | # Local History for Visual Studio Code 326 | .history/ 327 | 328 | # Built Visual Studio Code Extensions 329 | *.vsix 330 | 331 | # Build and Development directories 332 | /build 333 | /.idea 334 | /.vscode 335 | /src/build 336 | /packaging/linux/appimage/AppDir 337 | *.appimage 338 | *.AppImage 339 | /packaging/linux/flatpak/build-dir 340 | /packaging/linux/flatpak/.flatpak-builder 341 | /packaging/linux/flatpak/repo 342 | /packaging/linux/flatpak/*.flatpak 343 | /packaging/cargoPackager 344 | .cargo-packager 345 | /.profile 346 | /.zprofile 347 | -------------------------------------------------------------------------------- /src/view/top_bar.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | #![allow(unused_imports)] 17 | use crate::data::io::deinitialise_app; 18 | use crate::{ 19 | APP_ICON, 20 | data::stores::{CURRENT_TAB, TABS, THEME_STORE, close_tab, new_tab, switch_tab}, 21 | }; 22 | use freya::hooks::Window; 23 | use freya::prelude::*; 24 | 25 | #[component] 26 | pub fn top_nav_bar() -> Element { 27 | let theme = THEME_STORE().current_theme.colors; 28 | 29 | rsx!( 30 | rect { 31 | width: "100%", 32 | height: "40", 33 | direction: "horizontal", 34 | main_align: "space-between", 35 | cross_align: "center", 36 | background: "{ theme.base }", 37 | WindowDragArea { 38 | rect { 39 | width: "110", 40 | height: "100%" 41 | } 42 | } 43 | active_tabs {}, 44 | WindowDragArea { 45 | rect { 46 | width: "100%", 47 | height: "100%" 48 | } 49 | } 50 | NavigationButtons {} 51 | } 52 | ) 53 | } 54 | 55 | #[component] 56 | fn active_tabs() -> Element { 57 | let theme = THEME_STORE().current_theme.colors; 58 | 59 | let mut is_hovered = use_signal(|| false); 60 | 61 | let hover_animation = use_animation(move |_conf| { 62 | // conf.auto_start(false); 63 | AnimNum::new(0.0, 0.99999).time(150) 64 | }); 65 | 66 | let onmouseenter = move |_| { 67 | *is_hovered.write() = true; 68 | hover_animation.start(); 69 | }; 70 | 71 | let onmouseleave = move |_| { 72 | *is_hovered.write() = false; 73 | hover_animation.reverse(); 74 | }; 75 | 76 | let bg_hover_opacity = &*hover_animation.get().read_unchecked(); 77 | 78 | // let image_data = static_bytes(APP_ICON); 79 | rsx!( 80 | rect { 81 | direction: "horizontal", 82 | cross_align: "center", 83 | padding: "0 165 0 0", 84 | // spacing: "5", 85 | 86 | // App Icon Section 87 | // rect { 88 | // height: "80%", 89 | // width: "60", 90 | // cross_align: "center", 91 | // image { 92 | // width: "100%", 93 | // height: "100%", 94 | // image_data 95 | // } 96 | // }, 97 | 98 | // Tabs Section 99 | // ScrollView{ 100 | // direction: "horizontal", 101 | // scrollbar_theme: theme_with!( 102 | // ScrollBarTheme { 103 | // background: cow_borrowed!("transparent") 104 | // } 105 | // ), 106 | for (index, _tab) in TABS().iter().enumerate() { 107 | rect { 108 | height: "fill", 109 | width: "auto", 110 | main_align: "center", 111 | margin: "0 2", 112 | tab_button { 113 | index: index, 114 | on_click: move |_| switch_tab(index), 115 | } 116 | // } 117 | } 118 | } 119 | CursorArea { 120 | icon: CursorIcon::Pointer, 121 | rect { 122 | corner_radius: "100", 123 | padding: "4 10", 124 | margin: "1 2", 125 | background: "{ theme.surface1 }", 126 | background_opacity:"{ bg_hover_opacity.read() }", 127 | onmouseenter, 128 | onmouseleave, 129 | onclick: move |_| new_tab(), 130 | label { 131 | color: "{ theme.text }", 132 | font_size: "17", 133 | font_family: "JetBrains Mono", 134 | "+" 135 | } 136 | } 137 | } 138 | } 139 | ) 140 | } 141 | 142 | #[component] 143 | fn tab_button(index: usize, on_click: EventHandler<()>, children: Element) -> Element { 144 | let theme = THEME_STORE().current_theme.colors; 145 | // TODO: Handle Unwrap 146 | let title = TABS().get(index).unwrap().title.clone(); 147 | 148 | let mut is_hovered = use_signal(|| false); 149 | 150 | let hover_animation = use_animation(move |_conf| { 151 | // conf.auto_start(false); 152 | if CURRENT_TAB() == Some(index) { 153 | AnimNum::new(0.5, 0.99999).time(150) 154 | } else { 155 | AnimNum::new(0.0, 0.99999).time(150) 156 | } 157 | }); 158 | 159 | let onmouseenter = move |_| { 160 | *is_hovered.write() = true; 161 | hover_animation.start(); 162 | }; 163 | 164 | let onmouseleave = move |_| { 165 | *is_hovered.write() = false; 166 | hover_animation.reverse(); 167 | }; 168 | 169 | let bg_hover_opacity = &*hover_animation.get().read_unchecked(); 170 | 171 | rsx!( 172 | CursorArea { 173 | icon: CursorIcon::Pointer, 174 | rect { 175 | width: "160", 176 | height: "75%", 177 | padding: "2 12 2 15", 178 | direction: "horizontal", 179 | main_align: "space-between", 180 | cross_align: "center", 181 | background: "{ theme.surface1 }", 182 | background_opacity:"{ bg_hover_opacity.read() }", 183 | corner_radius: "50", 184 | onclick: move |_| on_click.call(()), 185 | onmouseenter, 186 | onmouseleave, 187 | label { 188 | color: "{ theme.text }", 189 | font_size: "15", 190 | font_family: "JetBrains Mono", 191 | "{title}" 192 | }, 193 | if CURRENT_TAB() == Some(index) || is_hovered() { 194 | label { 195 | color: "{ theme.text }", 196 | font_size: "17", 197 | font_family: "JetBrains Mono", 198 | onclick: move |_| close_tab(index), 199 | "×" 200 | } 201 | } 202 | } 203 | } 204 | ) 205 | } 206 | 207 | #[component] 208 | fn nav_button(on_click: EventHandler<()>, hover_color: String, children: Element) -> Element { 209 | let mut hovered = use_signal(|| false); 210 | 211 | let background = if *hovered.read() { hover_color } else { "transparent".to_string() }; 212 | 213 | rsx!( 214 | rect { 215 | background: "{background}", 216 | width: "55", 217 | height: "100%", 218 | padding: "3.5", 219 | main_align: "center", 220 | cross_align: "center", 221 | onclick: move |_| on_click.call(()), 222 | onmouseenter: move |_| hovered.set(true), 223 | onmouseleave: move |_| hovered.set(false), 224 | {children} 225 | } 226 | ) 227 | } 228 | 229 | #[component] 230 | fn NavigationButtons() -> Element { 231 | let platform = use_platform(); 232 | let platform_information = use_platform_information(); 233 | 234 | let theme = THEME_STORE().current_theme.colors; 235 | 236 | rsx!(rect { 237 | direction: "horizontal", 238 | width: "auto", 239 | height: "100%", 240 | nav_button { 241 | on_click: move |_| platform.set_minimize_window(true), 242 | hover_color: "{ theme.surface2 }", 243 | svg { 244 | width: "100%", 245 | height: "60%", 246 | stroke: "{ theme.text }", 247 | fill: "{ theme.text }", 248 | svg_content: include_str!("../static/svgs/minimise.svg") 249 | } 250 | }, 251 | nav_button { 252 | on_click: move |_| { 253 | platform.toggle_maximize_window(); 254 | }, 255 | hover_color: theme.surface2, 256 | if platform_information().is_maximized { 257 | svg { 258 | width: "90%", 259 | height: "60%", 260 | stroke: "{ theme.text }", 261 | fill: "{ theme.text }", 262 | svg_content: include_str!("../static/svgs/restore.svg") 263 | } 264 | } else { 265 | svg { 266 | width: "90%", 267 | height: "60%", 268 | stroke: "{ theme.text }", 269 | fill: "{ theme.text }", 270 | svg_content: include_str!("../static/svgs/maximise.svg") 271 | } 272 | } 273 | }, 274 | nav_button { 275 | on_click: move |_| { 276 | deinitialise_app(); 277 | platform.close_window(); 278 | }, 279 | hover_color: "#d20f39", 280 | svg { 281 | width: "90%", 282 | height: "60%", 283 | stroke: "{ theme.text }", 284 | fill: "{ theme.text }", 285 | svg_content: include_str!("../static/svgs/close.svg") 286 | } 287 | } 288 | }) 289 | } 290 | -------------------------------------------------------------------------------- /src/data/stores.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | /* 17 | ------------------------------------------------------------------------- 18 | File Index 19 | ------------------------------------------------------------------------- 20 | - Imports 21 | - Workspace Store 22 | - Tabs Store 23 | - UI Store 24 | ------------------------------------------------------------------------- 25 | 26 | ------------------------------------------------------------------------- 27 | Devloper Notes: 28 | ------------------------------------------------------------------------- 29 | NOTE: I made these global signals because it was the easy way to share a component state between 30 | different components. While this might not be the best way to do it, it works. 31 | TODO: Use Dioxus Radio for complex global states instead of global signals. 32 | ------------------------------------------------------------------------- 33 | */ 34 | 35 | //! Global Signals and their methods. 36 | 37 | //------------------------------------------------------------------------- 38 | // - Imports 39 | //------------------------------------------------------------------------- 40 | use crate::data::{ 41 | io::{delete_file, generate_available_path, get_default_trove_dir, new_file_from_path, save_file}, 42 | themes::ThemesStore, 43 | types::{DEFAULT_NOTE_TITLE, MarkdownFile, RecentFileInfo, Tab}, 44 | }; 45 | use dioxus_clipboard::hooks::{UseClipboard, use_clipboard}; 46 | use freya::prelude::*; 47 | use slab::Slab; 48 | 49 | //------------------------------------------------------------------------- 50 | // - Workspace Store 51 | //------------------------------------------------------------------------- 52 | pub static WORD_CHAR_COUNT: GlobalSignal<(usize, usize)> = Signal::global(|| (0, 0)); 53 | 54 | // NOTE: Using slab as a memory arena with random file push. 55 | pub static FILES_ARENA: GlobalSignal> = Signal::global(|| Slab::with_capacity(10)); 56 | pub static CURRENT_EDITOR_BUFFER: GlobalSignal = Signal::global(|| { 57 | use_editable( 58 | || EditableConfig::new("Welcome to Rhyolite!".trim().to_string()).with_allow_tabs(true), 59 | EditableMode::SingleLineMultipleEditors, 60 | ) 61 | }); 62 | pub static ACTIVE_DOCUMENT_TITLE: GlobalSignal = Signal::global(String::new); 63 | 64 | pub static RECENT_FILES: GlobalSignal> = Signal::global(Vec::new); 65 | 66 | pub static PLATFORM: GlobalSignal = Signal::global(use_platform); 67 | pub static CLIPBOARD: GlobalSignal = Signal::global(use_clipboard); 68 | 69 | //------------------------------------------------------------------------- 70 | // - Tabs Store 71 | //------------------------------------------------------------------------- 72 | pub(crate) static TABS: GlobalSignal> = Signal::global(Vec::new); 73 | pub(crate) static CURRENT_TAB: GlobalSignal> = Signal::global(|| None); 74 | 75 | /// Creates a new tab with a new Markdown file. 76 | pub(crate) async fn new_tab() { 77 | let document_path = generate_available_path(get_default_trove_dir().join(String::from(DEFAULT_NOTE_TITLE) + ".md")); 78 | 79 | let Some(markdownfile) = new_file_from_path(document_path) else { 80 | log::error!("Failed to create a new tab, due to a previous error!"); 81 | return; 82 | }; 83 | 84 | let file_key = FILES_ARENA.write().insert(markdownfile.clone()); 85 | push_tab(markdownfile.title.clone(), file_key).await; 86 | // *ACTIVE_DOCUMENT_TITLE.write() = markdownfile.title.clone(); 87 | let log_title = markdownfile.title.clone(); 88 | 89 | switch_tab(TABS().len() - 1).await; 90 | // *CURRENT_TAB.write() = Some(TABS().len() - 1); 91 | save_file(markdownfile).await; 92 | log::debug!("Opened New Tab: {log_title}"); 93 | } 94 | 95 | /// Closes the tab at the given index also freeing its buffer from FILES_BUFFER. 96 | pub async fn close_tab(index: usize) { 97 | if let Some(tab) = TABS().get(index) { 98 | let tab_title = tab.title.clone(); 99 | let buffer_index = tab.file_key; 100 | let tab_count = TABS().len(); 101 | if CURRENT_TAB() == Some(index) { 102 | if index != 0 { 103 | switch_tab(index - 1).await; 104 | } else if tab_count > 1 { 105 | switch_tab(index + 1).await; 106 | } else { 107 | return; 108 | } 109 | } 110 | save_file(FILES_ARENA().get(buffer_index).unwrap().clone()).await; 111 | TABS.write().remove(index); 112 | FILES_ARENA.write().remove(buffer_index); 113 | log::debug!("Closed tab: {tab_title}"); 114 | } else { 115 | log::error!("Failed to close the tab: Invalid tab index! (out of bounds)") 116 | } 117 | } 118 | 119 | /// Closes the tab at the given index also freeing its buffer from FILES_BUFFER, and deletes the file associated with it. 120 | pub async fn delete_tab(index: usize) { 121 | let Some(tab) = TABS().get(index).cloned() else { 122 | log::error!("Failed to delete the tab: Invalid tab index! (out of bounds)"); 123 | return; 124 | }; 125 | 126 | let tab_count = TABS().len(); 127 | let current_tab_index = CURRENT_TAB(); 128 | 129 | if (tab_count - 1) == 0 { 130 | new_tab().await; 131 | } 132 | 133 | TABS.write().remove(index); 134 | delete_file(FILES_ARENA().get(tab.file_key).unwrap().clone()).await; 135 | FILES_ARENA.write().remove(tab.file_key); 136 | 137 | match current_tab_index { 138 | // Deleting the current tab; switch to the previous or stay at 0 139 | Some(current) if current == index => { 140 | let new_index = if index > 0 { index - 1 } else { 0 }; 141 | switch_tab(new_index).await; 142 | } 143 | // Deleting previous to the current tab; Current tab index needs adjustment due to removal 144 | Some(current) if current > index => { 145 | switch_tab(current - 1).await; 146 | } 147 | _ => {} 148 | } 149 | 150 | log::debug!("Closed tab: {}", tab.title); 151 | } 152 | 153 | /// Appends a tab of the given title and document index to the TABS vec. 154 | pub async fn push_tab(title: String, file_key: usize) { 155 | let file_path = FILES_ARENA().get(file_key).unwrap().path.clone(); 156 | let newtab = Tab { 157 | title, 158 | file_path, 159 | file_key, 160 | }; 161 | TABS.write().push(newtab); 162 | } 163 | 164 | pub async fn switch_tab(index: usize) { 165 | if let Some(tab) = TABS().get(index) { 166 | *CURRENT_TAB.write() = Some(index); 167 | *ACTIVE_DOCUMENT_TITLE.write() = tab.title.clone(); 168 | let current_tab_content = FILES_ARENA() 169 | .get(TABS().get(CURRENT_TAB().unwrap()).unwrap().file_key) 170 | .unwrap() 171 | .editable; 172 | 173 | *CURRENT_EDITOR_BUFFER.write() = current_tab_content; 174 | log::debug!("Switched to tab: {}", tab.title.clone()); 175 | } else { 176 | log::error!("Failed to switch to the tab: Invalid tab index! (out of bounds)") 177 | } 178 | } 179 | 180 | pub async fn cycle_tab() { 181 | if let Some(index) = CURRENT_TAB() { 182 | let total_tabs = TABS().len(); 183 | if total_tabs > (index + 1) { 184 | switch_tab(index + 1).await; 185 | } else if total_tabs == (index + 1) { 186 | switch_tab(0).await; 187 | } 188 | } else { 189 | log::error!("Failed to cycle through the tabs: Invalid Current Tab Value!") 190 | } 191 | } 192 | 193 | //------------------------------------------------------------------------- 194 | // - UI Store 195 | //------------------------------------------------------------------------- 196 | 197 | // Fonts: 198 | pub static JET_BRAINS_MONO: &[u8] = include_bytes!("../static/fonts/JetBrainsMono[wght].ttf"); 199 | 200 | // Stores the current App Theme 201 | pub static THEME_STORE: GlobalSignal = Signal::global(ThemesStore::init); 202 | 203 | // Sidebar Store: 204 | pub static SHOW_SETTINGS_DROPUP: GlobalSignal = Signal::global(|| false); 205 | pub static SHOW_THEMES_DROPUP: GlobalSignal = Signal::global(|| false); 206 | pub static SHOW_COMMAND_PALETTE: GlobalSignal = Signal::global(|| false); 207 | pub static SHOW_RECENT_FILES: GlobalSignal = Signal::global(|| false); 208 | 209 | // Sidebar Store Methods: 210 | pub fn toggle_settings_dropup() { 211 | let current_state = SHOW_SETTINGS_DROPUP(); 212 | if current_state && SHOW_THEMES_DROPUP() { 213 | *SHOW_THEMES_DROPUP.write() = !current_state; 214 | } 215 | *SHOW_SETTINGS_DROPUP.write() = !current_state; 216 | } 217 | 218 | pub fn toggle_themes_dropup() { 219 | let current = *SHOW_THEMES_DROPUP.read(); 220 | *SHOW_THEMES_DROPUP.write() = !current; 221 | } 222 | 223 | pub fn close_settings_dropup() { 224 | *SHOW_SETTINGS_DROPUP.write() = false; 225 | *SHOW_THEMES_DROPUP.write() = false; 226 | } 227 | 228 | pub fn toggle_command_palette() { 229 | let current = *SHOW_COMMAND_PALETTE.read(); 230 | *SHOW_COMMAND_PALETTE.write() = !current; 231 | } 232 | 233 | pub fn toggle_recent_files() { 234 | let current = *SHOW_RECENT_FILES.read(); 235 | *SHOW_RECENT_FILES.write() = !current; 236 | } 237 | -------------------------------------------------------------------------------- /src/view/app_view.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | /* 17 | ------------------------------------------------------------------------- 18 | File Index 19 | ------------------------------------------------------------------------- 20 | - Imports 21 | - App Element 22 | - Other Functions 23 | ------------------------------------------------------------------------- 24 | */ 25 | 26 | //! Main view of the app(Parent View). 27 | 28 | //------------------------------------------------------------------------- 29 | // - Imports 30 | //------------------------------------------------------------------------- 31 | #[allow(unused_imports)] 32 | use crate::{ 33 | data::{ 34 | io::handle_global_keyboard_input, 35 | io::{deinitialise_app, initialise_app}, 36 | stores::{ 37 | CURRENT_EDITOR_BUFFER, CURRENT_TAB, FILES_ARENA, SHOW_COMMAND_PALETTE, SHOW_RECENT_FILES, SHOW_SETTINGS_DROPUP, TABS, 38 | THEME_STORE, WORD_CHAR_COUNT, close_settings_dropup, toggle_command_palette, toggle_recent_files, 39 | }, 40 | }, 41 | view::{docview::work_space, palette::palette_box, sidebar::side_bar, top_bar::top_nav_bar}, 42 | }; 43 | use freya::prelude::*; 44 | use winit::window::ResizeDirection; 45 | 46 | //------------------------------------------------------------------------- 47 | // - App Element 48 | //------------------------------------------------------------------------- 49 | /// The main view of the app, this is where the first component gets rendered. 50 | pub fn app() -> Element { 51 | let theme = THEME_STORE().current_theme.colors; 52 | const BORDER_SIZE: u8 = 6; 53 | 54 | use_hook(move || { 55 | initialise_app(); 56 | }); 57 | 58 | // Update the word and char counts on tab change/keyboard input. 59 | use_effect(move || { 60 | let editor_content = CURRENT_EDITOR_BUFFER().editor().to_string(); 61 | let char_count = editor_content.chars().count(); 62 | let word_count = editor_content.split_whitespace().count(); 63 | 64 | *WORD_CHAR_COUNT.write() = (word_count, char_count); 65 | }); 66 | 67 | // NOTE: Do not run this here, I am still figuring out how to deinitialise the app correctly, 68 | // for now I am running this function in docview/document_editor. 69 | // use_drop(move || { 70 | // deinitialise_app(); 71 | // }); 72 | 73 | rsx!( 74 | // 1 75 | rect { 76 | width: "fill", 77 | height: "fill", 78 | direction: "vertical", 79 | 80 | background: theme.crust, 81 | direction: "vertical", 82 | onglobalkeydown: handle_global_keyboard_input, 83 | drag_resize_area {border_size: BORDER_SIZE} 84 | 85 | // Tabs Navigation Bar 86 | top_nav_bar {} 87 | 88 | // Main Workspace 89 | rect { 90 | width: "100%", 91 | height: "fill", 92 | direction: "horizontal", 93 | side_bar{}, 94 | work_space{} 95 | } 96 | 97 | if SHOW_COMMAND_PALETTE() ^ SHOW_RECENT_FILES() ^ SHOW_SETTINGS_DROPUP() { 98 | overlay_view{} 99 | } 100 | } 101 | ) 102 | } 103 | 104 | //------------------------------------------------------------------------- 105 | // - Other Functions 106 | //------------------------------------------------------------------------- 107 | 108 | /// Handles the overlay view; this is where onclick handlers for closing the floating components (like palettes and settings dropup are handled). 109 | /// This is a hacky way to implement this; once a stable API for such stuff is implemented in Freya lib, then this will be replaced by those. 110 | /// 111 | /// Other ways of doing this are by using `use_focus()` to close the floating windows when unfocussed or by using the `onglobalclick` handler. 112 | #[component] 113 | pub fn overlay_view() -> Element { 114 | let _focus = use_focus(); 115 | let backdrop_blur_value: u8 = if SHOW_SETTINGS_DROPUP() { 0 } else { 1 }; 116 | let background_color = if SHOW_SETTINGS_DROPUP() { 117 | "rgb(0, 0, 0, 0.0)" 118 | } else { 119 | "rgb(0, 0, 0, 0.2)" 120 | }; 121 | 122 | rsx!(rect { 123 | position: "global", 124 | position_top: "0", 125 | position_left: "0", 126 | width: "100%", 127 | height: "100%", 128 | main_align: "center", 129 | cross_align: "center", 130 | background: background_color, 131 | backdrop_blur: "{backdrop_blur_value}", 132 | layer: "overlay", 133 | 134 | onclick: move |e| { 135 | e.stop_propagation(); 136 | if SHOW_RECENT_FILES() { 137 | toggle_recent_files(); 138 | } else if SHOW_COMMAND_PALETTE() { 139 | toggle_command_palette(); 140 | } else if SHOW_SETTINGS_DROPUP() { 141 | close_settings_dropup(); 142 | } 143 | }, 144 | 145 | if SHOW_COMMAND_PALETTE() ^ SHOW_RECENT_FILES() { 146 | // TODO: Implement the floating palettes. 147 | palette_box{ 148 | // if SHOW_RECENT_FILES() { 149 | // recent_files_palette{} 150 | // } else { 151 | // command_palette{} 152 | // } 153 | } 154 | } 155 | }) 156 | } 157 | 158 | /// A thin 6-8 pixels border over the app window running around the edges to handle window resizing. 159 | #[component] 160 | fn drag_resize_area(border_size: u8) -> Element { 161 | let platform = use_platform(); 162 | // NOTE: Adjust this value for resizing handles. 163 | let platform_information = use_platform_information(); 164 | let is_maximised = platform_information().is_maximized; 165 | 166 | if is_maximised { 167 | return rsx! {}; 168 | } 169 | 170 | let create_resize_handler = |direction: ResizeDirection| { 171 | move |_| { 172 | platform.with_window(move |window| { 173 | let _ = window.drag_resize_window(direction); 174 | }); 175 | } 176 | }; 177 | 178 | let create_set_cursor_handler = |cursor: CursorIcon| { 179 | move |_| { 180 | platform.set_cursor(cursor); 181 | } 182 | }; 183 | 184 | let reset_cursor_handler = move |_| { 185 | platform.set_cursor(CursorIcon::Default); 186 | }; 187 | 188 | rsx! { 189 | // window corners 190 | // Top-Left 191 | rect { 192 | position: "absolute", layer: "overlay", 193 | position_top: "0", position_left: "0", 194 | width: "{border_size}", height: "{border_size}", 195 | onmousedown: create_resize_handler(ResizeDirection::NorthWest), 196 | onmouseenter: create_set_cursor_handler(CursorIcon::NwResize), 197 | onmouseleave: reset_cursor_handler, 198 | } 199 | // Top-Right 200 | rect { 201 | position: "absolute", layer: "overlay", 202 | position_top: "0", position_right: "0", 203 | width: "{border_size}", height: "{border_size}", 204 | onmousedown: create_resize_handler(ResizeDirection::NorthEast), 205 | onmouseenter: create_set_cursor_handler(CursorIcon::NeResize), 206 | onmouseleave: reset_cursor_handler, 207 | } 208 | // Bottom-Left 209 | rect { 210 | position: "absolute", layer: "overlay", 211 | position_bottom: "0", position_left: "0", 212 | width: "{border_size}", height: "{border_size}", 213 | onmousedown: create_resize_handler(ResizeDirection::SouthWest), 214 | onmouseenter: create_set_cursor_handler(CursorIcon::SwResize), 215 | onmouseleave: reset_cursor_handler, 216 | } 217 | // Bottom-Right 218 | rect { 219 | position: "absolute", layer: "overlay", 220 | position_bottom: "0", position_right: "0", 221 | width: "{border_size}", height: "{border_size}", 222 | onmousedown: create_resize_handler(ResizeDirection::SouthEast), 223 | onmouseenter: create_set_cursor_handler(CursorIcon::SeResize), 224 | onmouseleave: reset_cursor_handler, 225 | } 226 | 227 | // Window edges 228 | // Top 229 | rect { 230 | position: "absolute", layer: "overlay", 231 | position_top: "0", position_left: "{border_size}", 232 | height: "{border_size}", 233 | width: "calc(100% - {2 * border_size}px)", 234 | onmousedown: create_resize_handler(ResizeDirection::North), 235 | onmouseenter: create_set_cursor_handler(CursorIcon::NResize), 236 | onmouseleave: reset_cursor_handler, 237 | } 238 | // Bottom 239 | rect { 240 | position: "absolute", layer: "overlay", 241 | position_bottom: "0", position_left: "{border_size}", 242 | height: "{border_size}", 243 | width: "calc(100% - {2 * border_size}px)", 244 | onmousedown: create_resize_handler(ResizeDirection::South), 245 | onmouseenter: create_set_cursor_handler(CursorIcon::SResize), 246 | onmouseleave: reset_cursor_handler, 247 | } 248 | // Left 249 | rect { 250 | position: "absolute", layer: "overlay", 251 | position_top: "{border_size}", position_left: "0", 252 | width: "{border_size}", 253 | height: "calc(100% - {2 * border_size}px)", 254 | onmousedown: create_resize_handler(ResizeDirection::West), 255 | onmouseenter: create_set_cursor_handler(CursorIcon::WResize), 256 | onmouseleave: reset_cursor_handler, 257 | } 258 | // Right 259 | rect { 260 | position: "absolute", layer: "overlay", 261 | position_top: "{border_size}", position_right: "0", 262 | width: "{border_size}", 263 | height: "calc(100% - {2 * border_size}px)", 264 | onmousedown: create_resize_handler(ResizeDirection::East), 265 | onmouseenter: create_set_cursor_handler(CursorIcon::EResize), 266 | onmouseleave: reset_cursor_handler, 267 | } 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /src/view/docview.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | /* 17 | ------------------------------------------------------------------------- 18 | File Index 19 | ------------------------------------------------------------------------- 20 | - Imports 21 | - Workspace Elements 22 | - Text Editor Virtualised(No wrapping) 23 | - Text Editor Virtualised(wrapping) 24 | ------------------------------------------------------------------------- 25 | 26 | 27 | ------------------------------------------------------------------------- 28 | Devloper Notes: 29 | ------------------------------------------------------------------------- 30 | NOTE: Work on a custom editor element for rhyolite is WIP. 31 | TODO: Add markdown and katex syntax highlighting. 32 | ------------------------------------------------------------------------- 33 | */ 34 | 35 | //------------------------------------------------------------------------- 36 | // - Imports 37 | //------------------------------------------------------------------------- 38 | use crate::{ 39 | data::{ 40 | io::handle_editor_key_input, 41 | io::{deinitialise_app, update_document_title}, 42 | stores::{ACTIVE_DOCUMENT_TITLE, CURRENT_EDITOR_BUFFER, THEME_STORE}, 43 | }, 44 | view::bottom_bar::bottom_floating_bar, 45 | }; 46 | use freya::prelude::*; 47 | use std::hash::{DefaultHasher, Hash, Hasher}; 48 | use tokio::time::Duration; 49 | use tokio::time::sleep; 50 | 51 | //------------------------------------------------------------------------- 52 | // - Workspace Elements 53 | //------------------------------------------------------------------------- 54 | 55 | #[component] 56 | pub fn work_space() -> Element { 57 | rsx!(rect { 58 | width: "fill", 59 | height: "fill", 60 | editor_area{} 61 | bottom_floating_bar {} 62 | }) 63 | } 64 | 65 | #[component] 66 | fn editor_area() -> Element { 67 | rsx!(rect { 68 | width: "fill", 69 | height: "fill", 70 | direction: "vertical", 71 | title_box{} 72 | editor_box{} 73 | }) 74 | } 75 | 76 | #[component] 77 | fn title_box() -> Element { 78 | let theme = THEME_STORE().current_theme.colors; 79 | 80 | let mut focus = use_focus(); 81 | 82 | let mut editable = use_editable( 83 | || EditableConfig::new("Untitled".trim().to_string()).with_allow_tabs(true), 84 | EditableMode::MultipleLinesSingleEditor, 85 | ); 86 | 87 | use_effect(move || { 88 | editable.editor_mut().write().set(ACTIVE_DOCUMENT_TITLE().as_str()); 89 | log::debug!("Document title updated"); 90 | }); 91 | 92 | let cursor_reference = editable.cursor_attr(); 93 | let highlights = editable.highlights_attr(0); 94 | let editor = editable.editor().read(); 95 | let cursor_char = editor.cursor_pos(); 96 | let mut is_cursor_blinking = use_signal(|| false); 97 | 98 | let onmousedown = move |e: MouseEvent| { 99 | focus.request_focus(); 100 | editable.process_event(&EditableEvent::MouseDown(e.data, 0)); 101 | }; 102 | 103 | let onmousemove = move |e: MouseEvent| { 104 | editable.process_event(&EditableEvent::MouseMove(e.data, 0)); 105 | }; 106 | 107 | let onclick = move |_: MouseEvent| { 108 | editable.process_event(&EditableEvent::Click); 109 | }; 110 | 111 | let onkeydown = move |e: KeyboardEvent| { 112 | if e.data.key == Key::Enter { 113 | let new_title = editable.editor().read().to_string(); 114 | spawn(async move { 115 | update_document_title(new_title).await; 116 | }); 117 | focus.request_unfocus(); 118 | } 119 | if handle_editor_key_input(&e) { 120 | editable.process_event(&EditableEvent::KeyDown(e.data)); 121 | } 122 | }; 123 | 124 | let onkeyup = move |e: KeyboardEvent| { 125 | if handle_editor_key_input(&e) { 126 | editable.process_event(&EditableEvent::KeyUp(e.data)); 127 | } 128 | }; 129 | 130 | // A future that runs a timer to toggle the blink signal 131 | use_future(move || async move { 132 | loop { 133 | sleep(Duration::from_millis(550)).await; 134 | if focus.is_focused() { 135 | is_cursor_blinking.toggle(); 136 | } 137 | } 138 | }); 139 | 140 | let cursor_color = if focus.is_focused() && *is_cursor_blinking.read() { 141 | theme.text.as_str() 142 | } else { 143 | "transparent" 144 | }; 145 | 146 | rsx!(rect{ 147 | width: "fill", 148 | height: "15%", 149 | min_height: "80", 150 | max_height: "100", 151 | main_align: "center", 152 | cross_align: "center", 153 | padding: "7", 154 | margin: "16 0 0 0", 155 | rect { 156 | width: "40%", 157 | min_width: "280", 158 | height: "fill", 159 | shadow: "5 8 8 2 rgb(0, 0, 0, 10)", 160 | background: "{theme.base}", 161 | corner_radius: "12", 162 | main_align: "center", 163 | padding: "4 12", 164 | 165 | CursorArea { 166 | icon: CursorIcon::Text, 167 | paragraph { 168 | width: "fill", 169 | cursor_id: "0", 170 | cursor_index: "{cursor_char}", 171 | cursor_mode: "editable", 172 | cursor_color: "{cursor_color}", 173 | highlights, 174 | highlight_color: "{theme.subtext1}", 175 | a11y_id: focus.attribute(), 176 | cursor_reference, 177 | onclick, 178 | onmousemove, 179 | onmousedown, 180 | onkeydown, 181 | onkeyup, 182 | color: "{theme.text}", 183 | font_size: "40", 184 | font_family: "JetBrains Mono", 185 | text_overflow: "ellipsis", 186 | max_lines: "1", 187 | text { 188 | "{editable.editor()}" 189 | } 190 | } 191 | } 192 | } 193 | }) 194 | } 195 | 196 | //------------------------------------------------------------------------- 197 | // - Text Editor Virtualised(No wrapping) 198 | //------------------------------------------------------------------------- 199 | 200 | #[allow(dead_code)] 201 | #[component] 202 | fn editor_box() -> Element { 203 | let mut focus = use_focus(); 204 | let mut editable = CURRENT_EDITOR_BUFFER(); 205 | let editor = editable.editor().read(); 206 | let mut is_cursor_blinking = use_signal(|| false); 207 | let theme = THEME_STORE().current_theme.colors; 208 | 209 | let onclick = move |_: MouseEvent| { 210 | *is_cursor_blinking.write() = true; 211 | editable.process_event(&EditableEvent::Click); 212 | }; 213 | 214 | let onkeydown = move |e: KeyboardEvent| { 215 | if handle_editor_key_input(&e) { 216 | editable.process_event(&EditableEvent::KeyDown(e.data)); 217 | } 218 | }; 219 | 220 | let onkeyup = move |e: KeyboardEvent| { 221 | if handle_editor_key_input(&e) { 222 | editable.process_event(&EditableEvent::KeyUp(e.data)); 223 | } 224 | }; 225 | 226 | let scrollbar_theme = theme_with!(ScrollBarTheme { 227 | background: cow_borrowed!("transparent"), // 228 | thumb_background: Cow::from(theme.surface0.clone()), 229 | hover_thumb_background: Cow::from(theme.surface1.clone()), 230 | active_thumb_background: Cow::from(theme.surface2.clone()), 231 | }); 232 | 233 | use_future(move || async move { 234 | loop { 235 | sleep(Duration::from_millis(500)).await; 236 | 237 | if focus.is_focused() { 238 | is_cursor_blinking.toggle(); 239 | } 240 | } 241 | }); 242 | 243 | // NOTE: This probably is not the correct place to run this function, however it works 244 | // correctly here, so for now the deinitialisation of the app run here. 245 | use_drop(move || { 246 | deinitialise_app(); 247 | }); 248 | 249 | rsx!(rect{ 250 | width: "fill", 251 | height: "fill", 252 | cross_align: "center", 253 | padding: "7", 254 | margin: "16 0 0 0", 255 | rect { 256 | width: "100%", 257 | height: "fill", 258 | background: "transparent", 259 | padding: "4 0", 260 | onkeydown, 261 | onkeyup, 262 | a11y_id: focus.attribute(), 263 | onclick, 264 | VirtualScrollView { 265 | width: "100%", 266 | height: "100%", 267 | padding: "0 10", 268 | length: editor.len_lines(), 269 | item_size: 25.0, 270 | show_scrollbar: true, 271 | scroll_with_arrows: true, 272 | scrollbar_theme, 273 | cache_elements: true, 274 | builder: move |line_index, _: &Option<()>| { 275 | let theme = THEME_STORE().current_theme.colors; 276 | let editor = editable.editor().read(); 277 | let line = editor.line(line_index).unwrap(); 278 | let is_line_selected = editor.cursor_row() == line_index; 279 | // Only show the cursor in the active line 280 | let character_index = if is_line_selected { 281 | editor.cursor_col().to_string() 282 | } else { 283 | "none".to_string() 284 | }; 285 | let cursor_color = if focus.is_focused() && *is_cursor_blinking.read() { 286 | theme.text.as_str() 287 | } else { 288 | "transparent" 289 | }; 290 | 291 | // Only highlight the active line 292 | // let line_background = if is_line_selected { 293 | // theme.subtext1.as_str() 294 | // } else { 295 | // "none" 296 | // }; 297 | 298 | let line_background = "none"; 299 | 300 | let onmousedown = move |e: MouseEvent| { 301 | focus.request_focus(); 302 | editable.process_event(&EditableEvent::MouseDown(e.data, line_index)); 303 | }; 304 | 305 | let onmousemove = move |e: MouseEvent| { 306 | editable.process_event(&EditableEvent::MouseMove(e.data, line_index)); 307 | }; 308 | 309 | let highlights = editable.highlights_attr(line_index); 310 | 311 | rsx! { 312 | rect { 313 | key: "{line_index}", 314 | width: "100%", 315 | height: "23", 316 | padding: "0 100", 317 | // content: "fit", 318 | direction: "horizontal", 319 | background: "{line_background}", 320 | CursorArea { 321 | icon: CursorIcon::Text, 322 | paragraph { 323 | cursor_reference: editable.cursor_attr(), 324 | main_align: "center", 325 | height: "100%", 326 | width: "97%", 327 | cursor_index: "{character_index}", 328 | cursor_color: "{cursor_color}", 329 | highlight_color: "{theme.subtext1}", 330 | max_lines: "1", 331 | cursor_mode: "editable", 332 | cursor_id: "{line_index}", 333 | onmousedown, 334 | onmousemove, 335 | highlights, 336 | text { 337 | color: "{theme.text}", 338 | font_size: "16", 339 | font_family: "JetBrains Mono", 340 | "{line}" 341 | } 342 | } 343 | } 344 | } 345 | } 346 | } 347 | } 348 | } 349 | }) 350 | } 351 | 352 | //------------------------------------------------------------------------- 353 | // - Text Editor Virtualised(wrapping) 354 | //------------------------------------------------------------------------- 355 | 356 | #[allow(dead_code)] 357 | #[component] 358 | fn editor_box_dynamic() -> Element { 359 | let mut focus = use_focus(); 360 | let mut editable = CURRENT_EDITOR_BUFFER(); 361 | let mut is_cursor_blinking = use_signal(|| false); 362 | let theme = THEME_STORE().current_theme.colors; 363 | 364 | let onclick = move |_: MouseEvent| { 365 | focus.request_focus(); 366 | *is_cursor_blinking.write() = true; 367 | editable.process_event(&EditableEvent::Click); 368 | }; 369 | 370 | let onkeydown = { 371 | move |e: KeyboardEvent| { 372 | if handle_editor_key_input(&e) { 373 | editable.process_event(&EditableEvent::KeyDown(e.data)); 374 | } 375 | } 376 | }; 377 | 378 | let onkeyup = { 379 | move |e: KeyboardEvent| { 380 | if handle_editor_key_input(&e) { 381 | editable.process_event(&EditableEvent::KeyUp(e.data)); 382 | } 383 | } 384 | }; 385 | 386 | let scrollbar_theme = theme_with!(ScrollBarTheme { 387 | background: cow_borrowed!("transparent"), // 388 | thumb_background: Cow::from(theme.surface0.clone()), 389 | hover_thumb_background: Cow::from(theme.surface1.clone()), 390 | active_thumb_background: Cow::from(theme.surface2.clone()), 391 | }); 392 | 393 | use_effect(move || { 394 | if focus.is_focused() { 395 | *is_cursor_blinking.write() = true; 396 | spawn(async move { 397 | while focus.is_focused() { 398 | sleep(Duration::from_millis(500)).await; 399 | if focus.is_focused() { 400 | is_cursor_blinking.toggle(); 401 | } 402 | } 403 | *is_cursor_blinking.write() = false; 404 | }); 405 | } else { 406 | *is_cursor_blinking.write() = false; 407 | } 408 | }); 409 | 410 | // NOTE: This probably is not the correct place to run this function, however it works 411 | // correctly here, so for now the deinitialise function run here. 412 | // TODO: Run this use_drop only if window decorations are enabled. 413 | // use_drop(move || { 414 | // deinitialise_app(); 415 | // }); 416 | 417 | // Generate a unique and stable key for each line by hashing its content. 418 | // Required by dynamic scroll view. 419 | let item_keys = use_memo(use_reactive(&editable, move |editable| { 420 | let editor = editable.editor().read(); 421 | (0..editor.len_lines()) 422 | .map(|i| { 423 | let mut hasher = DefaultHasher::new(); 424 | if let Some(line) = editor.line(i) { 425 | line.text.hash(&mut hasher); 426 | } 427 | i.hash(&mut hasher); 428 | hasher.finish() 429 | }) 430 | .collect::>() 431 | })); 432 | 433 | rsx!(rect{ 434 | width: "fill", 435 | height: "fill", 436 | cross_align: "center", 437 | padding: "7", 438 | margin: "16 0 40 0", 439 | rect { 440 | width: "100%", 441 | height: "fill", 442 | background: "transparent", 443 | padding: "4 0", 444 | onkeydown, 445 | onkeyup, 446 | a11y_id: focus.attribute(), 447 | onclick, 448 | DynamicVirtualScrollView { 449 | width: "100%", 450 | height: "100%", 451 | padding: "0 10", 452 | default_item_height: 5.0, 453 | overscan: 1, 454 | scroll_with_arrows: true, 455 | scroll_beyond_last_item: 10, 456 | min_scrollthumb_height: Some(30.0), 457 | item_keys: item_keys(), 458 | scrollbar_theme, 459 | builder: move |line_index| { 460 | let theme = THEME_STORE().current_theme.colors; 461 | let editor = editable.editor().read(); 462 | 463 | let line = match editor.line(line_index) { 464 | Some(line) => line, 465 | None => return rsx! { rect {} } 466 | }; 467 | 468 | let is_line_selected = editor.cursor_row() == line_index; 469 | let character_index = if is_line_selected { 470 | editor.cursor_col().to_string() 471 | } else { 472 | "none".to_string() 473 | }; 474 | let cursor_color = if focus.is_focused() && *is_cursor_blinking.read() { 475 | theme.text.as_str() 476 | } else { 477 | "transparent" 478 | }; 479 | let line_background = "none"; 480 | 481 | let onmousedown = move |e: MouseEvent| { 482 | editable.process_event(&EditableEvent::MouseDown(e.data, line_index)); 483 | }; 484 | 485 | let onmousemove = move |e: MouseEvent| { 486 | editable.process_event(&EditableEvent::MouseMove(e.data, line_index)); 487 | }; 488 | 489 | let highlights = editable.highlights_attr(line_index); 490 | 491 | rsx! { 492 | rect { 493 | width: "100%", 494 | height: "auto", 495 | content: "fit", 496 | direction: "horizontal", 497 | background: "{line_background}", 498 | padding: "0 100", 499 | CursorArea { 500 | icon: CursorIcon::Text, 501 | paragraph { 502 | cursor_reference: editable.cursor_attr(), 503 | main_align: "center", 504 | height: "auto", 505 | width: "97%", 506 | cursor_index: "{character_index}", 507 | cursor_color: "{cursor_color}", 508 | highlight_color: "{theme.subtext1}", 509 | cursor_mode: "editable", 510 | cursor_id: "{line_index}", 511 | onmousedown, 512 | onmousemove, 513 | highlights, 514 | text { 515 | color: "{theme.text}", 516 | font_size: "16", 517 | font_family: "JetBrains Mono", 518 | "{line}" 519 | } 520 | } 521 | } 522 | } 523 | } 524 | } 525 | } 526 | } 527 | }) 528 | } 529 | -------------------------------------------------------------------------------- /src/data/io.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 Suyog Tandel(RedddFoxxyy) 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with this program. If not, see . 15 | 16 | /* 17 | ------------------------------------------------------------------------- 18 | File Index 19 | ------------------------------------------------------------------------- 20 | - Imports 21 | - Logging 22 | - Document/Path IO 23 | - Keyboard/Mouse IO 24 | ------------------------------------------------------------------------- 25 | */ 26 | 27 | //! All IO related helper functions and utilities. 28 | 29 | //------------------------------------------------------------------------- 30 | // - Imports 31 | //------------------------------------------------------------------------- 32 | use crate::data::{ 33 | stores::{ 34 | ACTIVE_DOCUMENT_TITLE, CLIPBOARD, CURRENT_TAB, FILES_ARENA, PLATFORM, RECENT_FILES, TABS, THEME_STORE, close_tab, cycle_tab, 35 | delete_tab, new_tab, push_tab, switch_tab, toggle_command_palette, 36 | }, 37 | types::{APP_DATA_DIR, DEFAULT_TROVE_DIR, MarkdownFile, USER_DATA_FILE, UserData}, 38 | }; 39 | use freya::prelude::*; 40 | use log::LevelFilter; 41 | use log4rs::{ 42 | append::{ 43 | console::{ConsoleAppender, Target}, 44 | rolling_file::{ 45 | RollingFileAppender, 46 | policy::compound::{CompoundPolicy, roll::delete::DeleteRoller, trigger::size::SizeTrigger}, 47 | }, 48 | }, 49 | config::{Appender, Logger, Root}, 50 | encode::pattern::PatternEncoder, 51 | }; 52 | use std::{fs, io::Write, path::PathBuf}; 53 | use tokio::{ 54 | fs::{File, rename}, 55 | io::AsyncWriteExt, 56 | runtime::Runtime, 57 | }; 58 | 59 | //------------------------------------------------------------------------- 60 | // - Logging 61 | //------------------------------------------------------------------------- 62 | 63 | /// Initializes log4rs with custom configuration for stdout and file logging. 64 | pub fn logger_init() { 65 | let log_file_path = { 66 | let Some(state) = dirs::state_dir() else { 67 | log::error!("No App State directory could be found/accessed!"); 68 | panic!("Failed to find App State directory.") 69 | }; 70 | let log_dir = state.join(APP_DATA_DIR); 71 | 72 | if let Err(e) = fs::create_dir_all(&log_dir) { 73 | log::error!("Failed to create log directory!: {e}"); 74 | }; 75 | 76 | log_dir.join("rhyolite.log") 77 | }; 78 | 79 | // TODO: Add session based log files or rolling log files with archiving of old files, to prevent a single log file from growing too large. 80 | let size_trigger = SizeTrigger::new(10 * 1024 * 1024); // 10 MB 81 | let roller = DeleteRoller::new(); 82 | let policy = CompoundPolicy::new(Box::new(size_trigger), Box::new(roller)); 83 | 84 | let logfile = RollingFileAppender::builder() 85 | .encoder(Box::new(PatternEncoder::new("[{d(%Y-%m-%d %H:%M:%S %Z)} {l} {t}] {m}{n}"))) 86 | .build(log_file_path, Box::new(policy)) 87 | .unwrap(); 88 | 89 | let stdout = ConsoleAppender::builder() 90 | .target(Target::Stdout) 91 | .encoder(Box::new(PatternEncoder::new("[{d(%Y-%m-%d %H:%M:%S %Z)} {h({l})} {t}] {m}{n}"))) 92 | .build(); 93 | 94 | let (app_level, root_level) = if cfg!(debug_assertions) { 95 | (LevelFilter::Trace, LevelFilter::Debug) 96 | } else { 97 | (LevelFilter::Info, LevelFilter::Error) 98 | }; 99 | let config = log4rs::Config::builder() 100 | .appender(Appender::builder().build("stdout", Box::new(stdout))) 101 | .appender(Appender::builder().build("logfile", Box::new(logfile))) 102 | .logger(Logger::builder().build("Rhyolite", app_level)) 103 | .build(Root::builder().appenders(vec!["logfile", "stdout"]).build(root_level)) 104 | .unwrap(); 105 | 106 | log4rs::init_config(config).unwrap(); 107 | } 108 | 109 | //------------------------------------------------------------------------- 110 | // - Document/Path IO 111 | //------------------------------------------------------------------------- 112 | 113 | /// Returns the path to the default trove directory. 114 | pub fn get_default_trove_dir() -> PathBuf { 115 | // TODO: Handle path resolution/creation without panicking 116 | let Some(documents_path) = dirs::document_dir() else { 117 | log::error!("No document directory could be found/accessed!"); 118 | panic!("Failed to find Documents directory.") 119 | }; 120 | let default_trove_path = documents_path.join(DEFAULT_TROVE_DIR); 121 | fs::create_dir_all(&default_trove_path).expect("Could not create default Trove."); 122 | default_trove_path 123 | } 124 | 125 | /// Returns the path to the config directory for the app data. 126 | pub fn get_config_dir() -> PathBuf { 127 | // TODO: Handle path resolution/creation without panicking 128 | let Some(mut path) = dirs::config_dir() else { 129 | log::error!("No Config directory could be found/accessed!"); 130 | panic!("Failed to find Config directory.") 131 | }; 132 | path.push(APP_DATA_DIR); 133 | fs::create_dir_all(&path).expect("Could not create Rhyolite directory"); 134 | path 135 | } 136 | 137 | pub fn get_userdata_path() -> PathBuf { 138 | let userdata_dir = get_config_dir(); 139 | fs::create_dir_all(&userdata_dir).expect("Could not create Rhyolite config directory"); 140 | userdata_dir.join(USER_DATA_FILE) 141 | } 142 | 143 | /// Generate a path that is not conflicting by incrementing a counter at the file end 144 | pub fn generate_available_path(path: PathBuf) -> PathBuf { 145 | if !path.exists() { 146 | return path; 147 | } 148 | let suffix = path 149 | .extension() 150 | .map(|ext| format!(".{}", ext.to_string_lossy())) 151 | .unwrap_or("".to_string()); 152 | let prefix = path 153 | .file_stem() 154 | .unwrap_or_else(|| panic!("Unable to read path: {}", path.display())); 155 | let mut prefix_without_num = prefix 156 | .to_string_lossy() 157 | .to_string() 158 | .trim_end_matches(|c: char| c.is_ascii_digit()) 159 | .to_string(); 160 | if prefix.len() == prefix_without_num.len() && !prefix_without_num.ends_with(' ') { 161 | prefix_without_num.push(' '); 162 | } 163 | let mut num = 1; 164 | loop { 165 | let new_path = path.with_file_name(format!("{prefix_without_num} {num}{suffix}")); 166 | if !new_path.exists() { 167 | return new_path; 168 | } 169 | num += 1; 170 | } 171 | } 172 | 173 | /// Opens the file from the given path. 174 | pub fn _open_file_from_path(path: PathBuf) -> Option { 175 | let markdown_file = fs::read_to_string(path.clone()); 176 | 177 | // TODO: Handle this gracefully 178 | let file_name = path 179 | .clone() 180 | .file_stem() 181 | .unwrap_or_else(|| panic!("Unable to read path: {}", path.display())) 182 | .to_str() 183 | .unwrap() 184 | .to_string(); 185 | 186 | if let Ok(content) = markdown_file { 187 | Some(MarkdownFile { 188 | path, 189 | title: file_name, 190 | editable: UseEditable::new_in_hook( 191 | CLIPBOARD(), 192 | PLATFORM(), 193 | EditableConfig::new(content).with_allow_tabs(true), 194 | EditableMode::SingleLineMultipleEditors, 195 | ), 196 | }) 197 | } else { 198 | None 199 | } 200 | } 201 | 202 | /// Generates a new Markdown file from the given path (does not save it) 203 | pub fn new_file_from_path(path: PathBuf) -> Option { 204 | let cloned_path = path.clone(); 205 | 206 | let Some(file_name) = cloned_path.file_stem() else { 207 | // TODO: Improve the error message. 208 | log::error!("Unable to read path: {}", path.display()); 209 | return None; 210 | }; 211 | Some(MarkdownFile { 212 | path, 213 | title: file_name.to_string_lossy().into_owned(), 214 | editable: UseEditable::new_in_hook( 215 | CLIPBOARD(), 216 | PLATFORM(), 217 | EditableConfig::new(String::new()).with_allow_tabs(true), 218 | EditableMode::SingleLineMultipleEditors, 219 | ), 220 | }) 221 | } 222 | 223 | pub async fn save_userdata() { 224 | let last_open_tab = CURRENT_TAB().unwrap_or_default(); 225 | 226 | let current_editor_state = UserData { 227 | active_tabs: TABS(), 228 | last_open_tab, 229 | recent_files: RECENT_FILES(), 230 | current_theme: THEME_STORE().current_theme.clone(), 231 | }; 232 | 233 | if let Ok(toml_serialised_state) = toml::to_string::(¤t_editor_state) 234 | && let Ok(mut userdata_file) = fs::File::create(get_userdata_path()) 235 | { 236 | // TODO: Handle Error for this operation and the parent operations. 237 | let io_result = userdata_file.write(toml_serialised_state.as_bytes()); 238 | if io_result.is_err() { 239 | log::error!("Unable to write userdata file: {}", io_result.unwrap_err()); 240 | } 241 | } 242 | } 243 | 244 | pub fn load_files_from_trove(trove_path: PathBuf) { 245 | let mut markdownfiles: Vec = Vec::new(); 246 | 247 | // NOTE: Wrote this half asleep, do not judge :( 248 | if let Ok(entries) = fs::read_dir(&trove_path) { 249 | for entry in entries { 250 | let Ok(entry) = entry else { continue }; 251 | let path = entry.path(); 252 | 253 | if !path.is_file() { 254 | continue; 255 | } 256 | 257 | let Some(extension) = path.extension() else { 258 | log::error!("Failed to get the file extension, did not load {path:?}"); 259 | continue; 260 | }; 261 | 262 | if extension != "md" { 263 | log::error!("{path:?} is not a markdown file, skipped loading it."); 264 | continue; 265 | } 266 | 267 | let content = match fs::read_to_string(&path) { 268 | Ok(c) => c, 269 | Err(e) => { 270 | log::error!("Error reading file {path:?}: {e}"); 271 | // TODO: Handle the error 272 | continue; 273 | } 274 | }; 275 | 276 | let title = path.file_stem().and_then(|name| name.to_str()).unwrap().to_string(); 277 | 278 | let file_data = MarkdownFile { 279 | path: path.clone(), 280 | title, 281 | editable: UseEditable::new_in_hook( 282 | CLIPBOARD(), 283 | PLATFORM(), 284 | EditableConfig::new(content).with_allow_tabs(true), 285 | EditableMode::SingleLineMultipleEditors, 286 | ), 287 | }; 288 | 289 | markdownfiles.push(file_data); 290 | } 291 | } else { 292 | log::error!("Error reading directory: {trove_path:?}"); 293 | } 294 | 295 | let tokio = Runtime::new().unwrap(); 296 | 297 | if markdownfiles.is_empty() { 298 | tokio.block_on(new_tab()); 299 | } else { 300 | for file in markdownfiles { 301 | let title = file.title.clone(); 302 | let file_key = FILES_ARENA.write().insert(file); 303 | tokio.block_on(push_tab(title, file_key)); 304 | } 305 | *CURRENT_TAB.write() = Some(0); 306 | tokio.block_on(switch_tab(CURRENT_TAB().unwrap_or_default())); 307 | } 308 | } 309 | 310 | pub fn load_default_trove() { 311 | load_files_from_trove(get_default_trove_dir()) 312 | } 313 | 314 | pub fn load_from_userdata() { 315 | let userdata_string = fs::read_to_string(get_userdata_path()).expect("Could not read user data file"); 316 | 317 | let Ok(userdata) = toml::from_str::(userdata_string.as_str()) else { 318 | log::error!("Failed to load the userdata, corrupted userdata file."); 319 | // TODO: Handle Error 320 | let _ = fs::remove_file(get_userdata_path()); 321 | log::warn!("Loading all files from the default trove."); 322 | return load_default_trove(); 323 | }; 324 | 325 | let mut markdownfiles: Vec = Vec::new(); 326 | 327 | // NOTE: Wrote this half asleep, do not judge :( 328 | for tab in userdata.active_tabs { 329 | let path = tab.file_path; 330 | 331 | if !path.is_file() { 332 | log::error!("{path:?} is not a valid file!!!"); 333 | continue; 334 | } 335 | 336 | let Some(stem) = path.file_stem().and_then(|s| s.to_str()) else { 337 | log::error!("Failed to get the name of the file {path:?}"); 338 | continue; 339 | }; 340 | 341 | if stem != tab.title { 342 | log::error!("File name does not match the title of the tab in userdata, did not load {path:?}"); 343 | continue; 344 | } 345 | 346 | let Some(extension) = path.extension() else { 347 | log::error!("Failed to get the file extension, did not load {path:?}"); 348 | continue; 349 | }; 350 | 351 | if extension != "md" { 352 | log::error!("{path:?} is not a markdown file, skipped loading it."); 353 | continue; 354 | } 355 | 356 | let Ok(content) = fs::read_to_string(&path) else { 357 | log::error!("Error reading file {path:?}"); 358 | // TODO: Handle the error 359 | continue; 360 | }; 361 | 362 | let file_data = MarkdownFile { 363 | path, 364 | title: tab.title, 365 | editable: UseEditable::new_in_hook( 366 | CLIPBOARD(), 367 | PLATFORM(), 368 | EditableConfig::new(content).with_allow_tabs(true), 369 | EditableMode::SingleLineMultipleEditors, 370 | ), 371 | }; 372 | 373 | markdownfiles.push(file_data); 374 | } 375 | 376 | let tokio = Runtime::new().unwrap(); 377 | 378 | if markdownfiles.is_empty() { 379 | tokio.block_on(new_tab()); 380 | } else { 381 | for file in markdownfiles { 382 | let title = file.title.clone(); 383 | let file_key = FILES_ARENA.write().insert(file); 384 | tokio.block_on(push_tab(title, file_key)); 385 | } 386 | *CURRENT_TAB.write() = Some(userdata.last_open_tab); 387 | THEME_STORE.write().current_theme = userdata.current_theme; 388 | *RECENT_FILES.write() = userdata.recent_files; 389 | tokio.block_on(switch_tab(CURRENT_TAB().unwrap_or_default())); 390 | } 391 | } 392 | 393 | pub async fn save_file(markdownfile: MarkdownFile) { 394 | if let Ok(mut file) = File::create(markdownfile.path.clone()).await { 395 | if let Ok(_result) = file.write_all(markdownfile.editable.editor().to_string().as_bytes()).await { 396 | log::debug!("Successfully saved {} at {:#?}", markdownfile.title, markdownfile.path) 397 | } else { 398 | log::error!("Failed to save {} at {:#?}!", markdownfile.title, markdownfile.path) 399 | } 400 | } 401 | } 402 | 403 | pub async fn delete_file(markdownfile: MarkdownFile) { 404 | if let Ok(_result) = tokio::fs::remove_file(markdownfile.path.clone()).await { 405 | log::debug!("Successfully removed {}.", markdownfile.title) 406 | } else { 407 | log::error!("Failed to save the file!") 408 | } 409 | } 410 | 411 | pub async fn update_document_title(new_title: String) { 412 | let current_tab_index = CURRENT_TAB().unwrap(); 413 | let tabs = TABS.read(); 414 | 415 | let Some(tab) = tabs.get(current_tab_index) else { 416 | // TODO: Handle This error 417 | return; 418 | }; 419 | let file_key = tab.file_key; 420 | 421 | if let Some(markdown_file) = FILES_ARENA.write().get_mut(file_key) { 422 | let old_path = markdown_file.path.clone(); 423 | let new_path = old_path.with_file_name(format!("{}.md", new_title)); 424 | 425 | if let Err(e) = rename(&old_path, &new_path).await { 426 | log::error!("Failed to rename file: {}", e); 427 | return; 428 | } 429 | 430 | markdown_file.title = new_title.clone(); 431 | markdown_file.path = new_path.clone(); 432 | 433 | drop(tabs); 434 | 435 | let mut tabs_mut = TABS.write(); 436 | if let Some(tab_mut) = tabs_mut.get_mut(current_tab_index) { 437 | tab_mut.title = new_title.clone(); 438 | tab_mut.file_path = new_path; 439 | } 440 | 441 | *ACTIVE_DOCUMENT_TITLE.write() = new_title; 442 | } 443 | save_userdata().await; 444 | } 445 | 446 | /// Loads last saved State of the App. 447 | pub fn initialise_app() { 448 | let userdata_path = get_userdata_path(); 449 | 450 | if !userdata_path.exists() { 451 | log::error!("No UserData file found!!! Proceeding to load files from default trove!"); 452 | load_default_trove() 453 | } else { 454 | log::debug!("Loading last app state."); 455 | load_from_userdata() 456 | }; 457 | } 458 | 459 | // TODO: Mark saved files and only save the unsaved files. 460 | pub fn deinitialise_app() { 461 | let tokio = Runtime::new().unwrap(); 462 | for tab in TABS().iter() { 463 | if let Some(markdownfile) = FILES_ARENA().get(tab.file_key) { 464 | tokio.block_on(save_file(markdownfile.clone())); 465 | } 466 | } 467 | tokio.block_on(save_userdata()); 468 | } 469 | 470 | //------------------------------------------------------------------------- 471 | // - Keyboard/Mouse IO 472 | //------------------------------------------------------------------------- 473 | 474 | // #[derive(PartialEq)] 475 | // pub(crate) enum KeyboardInputComponent { 476 | // Global, 477 | // Editor(UseEditable), 478 | // } 479 | 480 | pub(crate) async fn handle_global_keyboard_input(e: KeyboardEvent) { 481 | let key = &e.data.key; 482 | let modifiers = e.data.modifiers; 483 | 484 | if !modifiers.contains(Modifiers::CONTROL) { 485 | return; 486 | } 487 | match key { 488 | Key::Character(c) if c == "s" => { 489 | e.stop_propagation(); 490 | log::debug!("CTRL + S was Pressed."); 491 | let current_tab_content = FILES_ARENA() 492 | .get(TABS().get(CURRENT_TAB().unwrap()).unwrap().file_key) 493 | .unwrap() 494 | .clone(); 495 | save_file(current_tab_content).await; 496 | } 497 | Key::Character(c) if (c == "D" && modifiers.contains(Modifiers::SHIFT)) => { 498 | e.stop_propagation(); 499 | log::debug!("CTRL + SHIFT + D was Pressed."); 500 | if let Some(tab_index) = CURRENT_TAB() { 501 | delete_tab(tab_index).await 502 | } 503 | } 504 | Key::Character(c) if c == "w" => { 505 | e.stop_propagation(); 506 | log::debug!("CTRL + W was Pressed."); 507 | if let Some(tab_index) = CURRENT_TAB() { 508 | close_tab(tab_index).await 509 | } 510 | } 511 | Key::Character(c) if c == "t" => { 512 | e.stop_propagation(); 513 | log::debug!("CTRL + T was Pressed."); 514 | new_tab().await 515 | } 516 | Key::Character(c) if c == "p" => { 517 | e.stop_propagation(); 518 | log::debug!("CTRL + P was Pressed."); 519 | toggle_command_palette(); 520 | } 521 | Key::Tab => { 522 | e.stop_propagation(); 523 | log::debug!("CTRL + Tab was Pressed."); 524 | cycle_tab().await; 525 | } 526 | _ => (), 527 | } 528 | } 529 | 530 | pub(crate) fn handle_editor_key_input(e: &KeyboardEvent) -> bool { 531 | let mods = &e.data.modifiers; 532 | let key = &e.data.key; 533 | 534 | let is_ctrl_char = |ch: &str| mods.contains(Modifiers::CONTROL) && key == &Key::Character(ch.into()); 535 | 536 | let skip = is_ctrl_char("s") // Save 537 | || is_ctrl_char("t") // New tab 538 | || is_ctrl_char("p") // Open command palette 539 | || is_ctrl_char("w") // Close tab 540 | || (mods.contains(Modifiers::CONTROL) 541 | && mods.contains(Modifiers::SHIFT) 542 | && key == &Key::Character("D".into())) // Delete 543 | || (mods.contains(Modifiers::CONTROL) 544 | && matches!(e.data.code, Code::Tab)); // Tab cycle 545 | 546 | !skip 547 | } 548 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------
Open-source Markdown editor to connect your ideas.