From a1c80efe69452a2ab2fdc3df16b31765c7faaa1b Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 22 Jan 2024 08:42:18 +0100 Subject: [PATCH 1/4] refactor: use `libcosmic::dialog` and make `rfd` optional --- Cargo.lock | 39 ++++++++++++++++++++------------------- Cargo.toml | 11 +++++++---- src/main.rs | 22 +++++++++++----------- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fbfce7d..d34c7c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -998,7 +998,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1013,7 +1013,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "quote", "syn 1.0.109", @@ -1036,7 +1036,6 @@ dependencies = [ "log", "notify", "patch", - "rfd", "rust-embed", "serde", "syntect", @@ -1083,7 +1082,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "almost", "cosmic-config", @@ -2612,7 +2611,7 @@ dependencies = [ [[package]] name = "iced" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_accessibility", "iced_core", @@ -2627,7 +2626,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "accesskit", "accesskit_winit", @@ -2636,7 +2635,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "bitflags 1.3.2", "instant", @@ -2652,7 +2651,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "futures", "iced_core", @@ -2665,7 +2664,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2688,7 +2687,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2701,7 +2700,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_core", "iced_futures", @@ -2711,7 +2710,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_core", "once_cell", @@ -2721,7 +2720,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "bytemuck", "cosmic-text", @@ -2739,7 +2738,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2759,7 +2758,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_renderer", "iced_runtime", @@ -2773,7 +2772,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "iced_graphics", "iced_runtime", @@ -3091,7 +3090,7 @@ checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#4e18199444aecbc60f25a12e8adb91926aa5e653" +source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" dependencies = [ "apply", "ashpd", @@ -3113,6 +3112,7 @@ dependencies = [ "iced_winit", "lazy_static", "palette", + "rfd", "slotmap", "taffy", "thiserror", @@ -4678,10 +4678,11 @@ dependencies = [ [[package]] name = "rfd" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9e7b57df6e8472152674607f6cc68aa14a748a3157a857a94f516e11aeacc2" +checksum = "c0d8ab342bcc5436e04d3a4c1e09e17d74958bfaddf8d5fad6f85607df0f994f" dependencies = [ + "ashpd", "block", "dispatch", "glib-sys", diff --git a/Cargo.toml b/Cargo.toml index ddf703b..c138217 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,6 @@ lexical-sort = "0.3.1" log = "0.4.20" patch = "0.7.0" notify = "6.1.1" -#TODO: this is using gtk for file dialogues -rfd = { version = "0.12.0", optional = true } serde = { version = "1", features = ["serde_derive"] } tokio = { version = "1", features = ["process", "time"] } # Extra syntax highlighting @@ -35,9 +33,9 @@ features = ["syntect", "vi"] [dependencies.libcosmic] git = "https://github.com/pop-os/libcosmic" +branch = "dialog" default-features = false features = ["tokio", "winit"] -#path = "../libcosmic" #TODO: clean up and send changes upstream [dependencies.systemicons] @@ -47,8 +45,13 @@ git = "https://github.com/jackpot51/systemicons" fork = "0.1" [features] -default = ["rfd", "wgpu"] +default = ["xdg-portal", "wgpu"] +# Use RFD for file chooser dialogs +rfd = ["libcosmic/rfd"] +# Enable GPU rendering with WGPU wgpu = ["libcosmic/wgpu"] +# Use XDG portal dialogs on Linux +xdg-portal = ["libcosmic/xdg-portal"] [patch.crates-io] smithay-client-toolkit = { git = "https://github.com/pop-os/client-toolkit", branch = "wayland-resize" } diff --git a/src/main.rs b/src/main.rs index 5aa3581..6360ad4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,9 @@ use cosmic::{ app::{message, Command, Core, Settings}, cosmic_config::{self, CosmicConfigEntry}, - cosmic_theme, executor, + cosmic_theme, + dialog::file_chooser, + executor, font::Font, iced::{ clipboard, event, @@ -1437,17 +1439,15 @@ impl Application for App { } }, Message::OpenFileDialog => { - #[cfg(feature = "rfd")] - return Command::perform( - async { - if let Some(handle) = rfd::AsyncFileDialog::new().pick_file().await { - message::app(Message::OpenFile(handle.path().to_owned())) - } else { - message::none() + return cosmic::command::future(async { + if let Ok(response) = file_chooser::open::Dialog::new().open_file().await { + if let Ok(path) = response.url().to_file_path() { + return message::app(Message::OpenFile(path)); } - }, - |x| x, - ); + } + + message::none() + }); } Message::OpenFile(path) => { self.open_tab(Some(path)); From 7a70472572f7018cfe7a38b987b922a7e15cd8e3 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Fri, 26 Jan 2024 16:37:52 +0100 Subject: [PATCH 2/4] feat: tab pagination and variable-button widths --- Cargo.lock | 413 ++++++++++++++++++++++++++++++++-------------------- Cargo.toml | 1 - src/main.rs | 53 +++---- 3 files changed, 280 insertions(+), 187 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d34c7c1..c41bf49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,17 +103,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" -[[package]] -name = "ahash" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.7" @@ -667,9 +656,9 @@ checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9" dependencies = [ "bytemuck_derive", ] @@ -731,6 +720,32 @@ dependencies = [ "vec_map", ] +[[package]] +name = "calloop" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" +dependencies = [ + "bitflags 2.4.2", + "log", + "polling 3.3.2", + "rustix 0.38.30", + "slab", + "thiserror", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +dependencies = [ + "calloop 0.12.4", + "rustix 0.38.30", + "wayland-backend", + "wayland-client 0.31.1", +] + [[package]] name = "cc" version = "1.0.83" @@ -771,16 +786,16 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -807,21 +822,21 @@ dependencies = [ [[package]] name = "clipboard_wayland" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6364a9f7a66f2ac1a1a098aa1c7f6b686f2496c6ac5e5c0d773445df912747" +checksum = "8134163bd07c47ae3cc29babc42c255fdb315facc790950ae2d0e561ea6f2ec0" dependencies = [ "smithay-clipboard", ] [[package]] name = "clipboard_x11" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983a7010836ecd04dde2c6d27a0cb56ec5d21572177e782bdcb24a600124e921" +checksum = "5cf45b436634fee64c6d3981639b46a87eeea3c64e422643273fcefd1baef56c" dependencies = [ "thiserror", - "x11rb 0.9.0", + "x11rb 0.13.0", ] [[package]] @@ -901,6 +916,26 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom", + "once_cell", + "tiny-keccak", +] + [[package]] name = "core-foundation" version = "0.7.0" @@ -998,22 +1033,24 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "atomicwrites", "cosmic-config-derive", - "dirs 5.0.1", + "dirs", "iced_futures", + "known-folders", "notify", "once_cell", "ron", "serde", + "xdg", ] [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "quote", "syn 1.0.109", @@ -1057,7 +1094,7 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.10.0" -source = "git+https://github.com/pop-os/cosmic-text#8457e68d984c465f7c5306424a73aa162aff32f2" +source = "git+https://github.com/pop-os/cosmic-text#e0ae465f918cd1cffca3a8239547dcf8166d3f77" dependencies = [ "bitflags 2.4.2", "cosmic_undo_2", @@ -1082,7 +1119,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "almost", "cosmic-config", @@ -1226,6 +1263,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" +[[package]] +name = "cursor-icon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" + [[package]] name = "d3d12" version = "0.7.0" @@ -1314,7 +1357,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.14.3", + "hashbrown", "lock_api", "once_cell", "parking_lot_core 0.9.9", @@ -1378,22 +1421,13 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys 0.3.7", -] - [[package]] name = "dirs" version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "dirs-sys 0.4.1", + "dirs-sys", ] [[package]] @@ -1406,17 +1440,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dirs-sys" version = "0.4.1" @@ -1477,9 +1500,12 @@ dependencies = [ [[package]] name = "dlv-list" -version = "0.3.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" +checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f" +dependencies = [ + "const-random", +] [[package]] name = "downcast-rs" @@ -1569,9 +1595,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -1829,11 +1855,11 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fontconfig-parser" -version = "0.5.3" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "674e258f4b5d2dcd63888c01c68413c51f565e8af99d2f7701c7b81d79ef41c4" +checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" dependencies = [ - "roxmltree 0.18.1", + "roxmltree", ] [[package]] @@ -1844,7 +1870,7 @@ checksum = "98b88c54a38407f7352dd2c4238830115a6377741098ffd1f997c813d0e088a6" dependencies = [ "fontconfig-parser", "log", - "memmap2 0.9.3", + "memmap2 0.9.4", "slotmap", "tinyvec", "ttf-parser 0.20.0", @@ -1922,11 +1948,11 @@ dependencies = [ [[package]] name = "freedesktop-icons" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9d46a9ae065c46efb83854bb10315de6d333bb6f4526ebe320c004dab7857e" +checksum = "b5339cbd60b2ff6b95ef212ab96bc80bf1a9dff2821b9966c417cdfae2808796" dependencies = [ - "dirs 4.0.0", + "dirs", "once_cell", "rust-ini", "thiserror", @@ -2102,9 +2128,9 @@ dependencies = [ [[package]] name = "gethostname" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" dependencies = [ "libc", "winapi", @@ -2112,12 +2138,12 @@ dependencies = [ [[package]] name = "gethostname" -version = "0.3.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" dependencies = [ "libc", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -2302,7 +2328,7 @@ checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" dependencies = [ "bitflags 2.4.2", "gpu-descriptor-types", - "hashbrown 0.14.3", + "hashbrown", ] [[package]] @@ -2390,7 +2416,7 @@ dependencies = [ "grep-matcher", "log", "memchr", - "memmap2 0.9.3", + "memmap2 0.9.4", ] [[package]] @@ -2451,22 +2477,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.7", -] - [[package]] name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.7", + "ahash", "allocator-api2", ] @@ -2611,7 +2628,7 @@ dependencies = [ [[package]] name = "iced" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_accessibility", "iced_core", @@ -2626,7 +2643,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "accesskit", "accesskit_winit", @@ -2635,7 +2652,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "bitflags 1.3.2", "instant", @@ -2651,7 +2668,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "futures", "iced_core", @@ -2664,7 +2681,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2687,7 +2704,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2700,7 +2717,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_core", "iced_futures", @@ -2710,7 +2727,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_core", "once_cell", @@ -2720,7 +2737,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "bytemuck", "cosmic-text", @@ -2738,7 +2755,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2758,7 +2775,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_renderer", "iced_runtime", @@ -2772,7 +2789,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "iced_graphics", "iced_runtime", @@ -2868,7 +2885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown", ] [[package]] @@ -3018,6 +3035,15 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "known-folders" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4397c789f2709d23cfcb703b316e0766a8d4b17db2d47b0ab096ef6047cae1d8" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "kqueue" version = "1.0.8" @@ -3090,7 +3116,7 @@ checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic?branch=dialog#6e8afc8341a4b5ef9ab453485ddf1acbbf256b72" +source = "git+https://github.com/pop-os/libcosmic#d5b2a2e87cacf83843fc676cabeae7f84a8a8774" dependencies = [ "apply", "ashpd", @@ -3243,7 +3269,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" dependencies = [ - "hashbrown 0.14.3", + "hashbrown", ] [[package]] @@ -3333,9 +3359,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -3611,19 +3637,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nix" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.24.3" @@ -3991,12 +4004,12 @@ dependencies = [ [[package]] name = "ordered-multimap" -version = "0.4.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +checksum = "a4d6a8c22fc714f0c2373e6091bf6f5e9b37b1bc0b1184874b7e0a4e303d318f" dependencies = [ "dlv-list", - "hashbrown 0.12.3", + "hashbrown", ] [[package]] @@ -4259,18 +4272,18 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -4438,9 +4451,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -4620,9 +4633,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -4632,9 +4645,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -4721,15 +4734,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "roxmltree" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862340e351ce1b271a378ec53f304a5558f7db87f3769dc655a8f6ecbb68b302" -dependencies = [ - "xmlparser", -] - [[package]] name = "roxmltree" version = "0.19.0" @@ -4772,9 +4776,9 @@ dependencies = [ [[package]] name = "rust-ini" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +checksum = "3e0698206bcb8882bf2a9ecb4c1e7785db57ff052297085a6efd4fe42302068a" dependencies = [ "cfg-if 1.0.0", "ordered-multimap", @@ -5059,9 +5063,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay-client-toolkit" @@ -5100,14 +5104,40 @@ dependencies = [ "wayland-protocols 0.29.5", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" +dependencies = [ + "bitflags 2.4.2", + "calloop 0.12.4", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2 0.9.4", + "rustix 0.38.30", + "thiserror", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-csd-frame", + "wayland-cursor 0.31.0", + "wayland-protocols 0.31.0", + "wayland-protocols-wlr", + "wayland-scanner 0.31.0", + "xkeysym", +] + [[package]] name = "smithay-clipboard" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +checksum = "0bb62b280ce5a5cba847669933a0948d00904cf83845c944eae96a4738cea1a6" dependencies = [ - "smithay-client-toolkit 0.16.1", - "wayland-client 0.29.5", + "libc", + "smithay-client-toolkit 0.18.0", + "wayland-backend", ] [[package]] @@ -5145,7 +5175,7 @@ dependencies = [ "foreign-types 0.5.0", "js-sys", "log", - "memmap2 0.9.3", + "memmap2 0.9.4", "objc", "raw-window-handle 0.5.2", "redox_syscall 0.4.1", @@ -5428,6 +5458,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tiny-skia" version = "0.8.4" @@ -5742,9 +5781,9 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f91c8b21fbbaa18853c3d0801c78f4fc94cdb976699bb03e832e75f7fd22f0" +checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" [[package]] name = "unicode-script" @@ -5814,7 +5853,7 @@ dependencies = [ "imagesize", "kurbo", "log", - "roxmltree 0.19.0", + "roxmltree", "simplecss", "siphasher", "svgtypes", @@ -6052,6 +6091,17 @@ dependencies = [ "wayland-sys 0.29.5", ] +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.4.2", + "cursor-icon", + "wayland-backend", +] + [[package]] name = "wayland-cursor" version = "0.28.6" @@ -6074,6 +6124,17 @@ dependencies = [ "xcursor", ] +[[package]] +name = "wayland-cursor" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" +dependencies = [ + "nix 0.26.4", + "wayland-client 0.31.1", + "xcursor", +] + [[package]] name = "wayland-protocols" version = "0.28.6" @@ -6098,6 +6159,31 @@ dependencies = [ "wayland-scanner 0.29.5", ] +[[package]] +name = "wayland-protocols" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" +dependencies = [ + "bitflags 2.4.2", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-scanner 0.31.0", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +dependencies = [ + "bitflags 2.4.2", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-protocols 0.31.0", + "wayland-scanner 0.31.0", +] + [[package]] name = "wayland-scanner" version = "0.28.6" @@ -6177,9 +6263,9 @@ dependencies = [ [[package]] name = "weezl" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu" @@ -6688,18 +6774,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "x11rb" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a" -dependencies = [ - "gethostname 0.2.3", - "nix 0.22.3", - "winapi", - "winapi-wsapoll", -] - [[package]] name = "x11rb" version = "0.12.0" @@ -6714,7 +6788,18 @@ dependencies = [ "once_cell", "winapi", "winapi-wsapoll", - "x11rb-protocol", + "x11rb-protocol 0.12.0", +] + +[[package]] +name = "x11rb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +dependencies = [ + "gethostname 0.4.3", + "rustix 0.38.30", + "x11rb-protocol 0.13.0", ] [[package]] @@ -6726,6 +6811,12 @@ dependencies = [ "nix 0.26.4", ] +[[package]] +name = "x11rb-protocol" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" + [[package]] name = "xcursor" version = "0.3.5" @@ -6762,16 +6853,16 @@ dependencies = [ ] [[package]] -name = "xml-rs" -version = "0.8.19" +name = "xkeysym" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" [[package]] -name = "xmlparser" -version = "0.13.6" +name = "xml-rs" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "xmlwriter" diff --git a/Cargo.toml b/Cargo.toml index c138217..ed1267a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,6 @@ features = ["syntect", "vi"] [dependencies.libcosmic] git = "https://github.com/pop-os/libcosmic" -branch = "dialog" default-features = false features = ["tokio", "winit"] diff --git a/src/main.rs b/src/main.rs index 6360ad4..6493c8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use cosmic::{ futures::{self, SinkExt}, keyboard::{self, Modifiers}, subscription, - widget::{row, text}, + widget::text, window, Alignment, Background, Color, Length, Point, }, style, theme, @@ -1908,20 +1908,23 @@ impl Application for App { let mut tab_column = widget::column::with_capacity(3).padding([space_none, space_xxs]); tab_column = tab_column.push( - row![ - view_switcher::horizontal(&self.tab_model) - .button_height(32) - .button_spacing(space_xxs) - .close_icon(icon_cache_get("window-close-symbolic", 16)) - .on_activate(Message::TabActivate) - .on_close(Message::TabClose) - .width(Length::Shrink), - button(icon_cache_get("list-add-symbolic", 16)) - .on_press(Message::NewFile) - .padding(space_xxs) - .style(style::Button::Icon) - ] - .align_items(Alignment::Center), + widget::row::with_capacity(2) + .align_items(Alignment::Center) + .push( + view_switcher::horizontal(&self.tab_model) + .button_height(32) + .button_spacing(space_xxs) + .close_icon(icon_cache_get("window-close-symbolic", 16)) + .on_activate(Message::TabActivate) + .on_close(Message::TabClose) + .width(Length::Shrink), + ) + .push( + button(icon_cache_get("list-add-symbolic", 16)) + .on_press(Message::NewFile) + .padding(space_xxs) + .style(style::Button::Icon), + ), ); let tab_id = self.tab_model.active(); @@ -2220,24 +2223,24 @@ impl Application for App { Self::APP_ID.into(), CONFIG_VERSION, ) - .map(|(_, res)| match res { - Ok(config) => Message::Config(config), - Err((errs, config)) => { - log::info!("errors loading config: {:?}", errs); - Message::Config(config) + .map(|update| { + for error in update.errors { + log::error!("error loading config: {error:?}"); } + + Message::Config(update.config) }), cosmic_config::config_subscription::<_, cosmic_theme::ThemeMode>( TypeId::of::(), cosmic_theme::THEME_MODE_ID.into(), cosmic_theme::ThemeMode::version(), ) - .map(|(_, u)| match u { - Ok(t) => Message::SystemThemeModeChange(t), - Err((errs, t)) => { - log::info!("errors loading theme mode: {:?}", errs); - Message::SystemThemeModeChange(t) + .map(|update| { + for error in update.errors { + log::error!("error loading theme mode: {error:?}"); } + + Message::SystemThemeModeChange(update.config) }), ]) } From b0c55c4c8da8be8492365cf6f3fcc4703485b1fc Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Fri, 26 Jan 2024 17:15:28 +0100 Subject: [PATCH 3/4] build(debian): remove libgtk dependency --- debian/control | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/control b/debian/control index d9f8290..76c1214 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,6 @@ Maintainer: Jeremy Soller Build-Depends: debhelper-compat (=13), just (>= 1.13.0), - libgtk-3-dev, pkg-config, rust-all, Standards-Version: 4.6.2 From 438e0c026eb8146cf7630051f89d9a44377f2a23 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Fri, 26 Jan 2024 17:16:01 +0100 Subject: [PATCH 4/4] build(nix): remove gtk dependency --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index d352e18..2ca7af8 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,6 @@ ]; }; nativeBuildInputs = with pkgs; [ - gtk3 just pkg-config autoPatchelfHook