diff --git a/Cargo.lock b/Cargo.lock index 1fd9c035..2a8b9831 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,20 +9,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] -name = "ab_glyph" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe21446ad43aa56417a767f3e2f3d7c4ca522904de1dd640529a76e9c5c3b33c" +name = "accesskit" +version = "0.11.0" +source = "git+https://github.com/wash2/accesskit.git?tag=v0.11.0#2dee3df0a525d727df9f54ae71cfe8b47d7c2751" + +[[package]] +name = "accesskit_consumer" +version = "0.15.0" +source = "git+https://github.com/wash2/accesskit.git?tag=v0.11.0#2dee3df0a525d727df9f54ae71cfe8b47d7c2751" dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", + "accesskit", ] [[package]] -name = "ab_glyph_rasterizer" -version = "0.1.8" +name = "accesskit_unix" +version = "0.4.0" +source = "git+https://github.com/wash2/accesskit.git?tag=v0.11.0#2dee3df0a525d727df9f54ae71cfe8b47d7c2751" +dependencies = [ + "accesskit", + "accesskit_consumer", + "async-channel", + "atspi", + "futures-lite", + "log", + "serde", + "zbus", +] + +[[package]] +name = "addr2line" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] [[package]] name = "adler" @@ -42,10 +63,21 @@ dependencies = [ ] [[package]] -name = "aho-corasick" -version = "0.7.20" +name = "ahash" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] @@ -56,6 +88,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -67,9 +105,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "apply" @@ -98,12 +136,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -112,11 +144,11 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "ash" -version = "0.37.2+1.3.238" +version = "0.37.3+1.3.251" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03" +checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" dependencies = [ - "libloading", + "libloading 0.7.4", ] [[package]] @@ -180,7 +212,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.9", + "rustix 0.37.19", "slab", "socket2", "waker-fn", @@ -195,6 +227,24 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 0.37.19", + "signal-hook", + "windows-sys 0.48.0", +] + [[package]] name = "async-recursion" version = "1.0.4" @@ -203,7 +253,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -220,7 +270,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -231,13 +281,40 @@ checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" [[package]] name = "atomicwrites" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a580bfc0fc2370333eddb71de8c8614d5972e3a327438eb3acc22824a638bf" +checksum = "c1163d9d7c51de51a2b79d6df5e8888d11e9df17c752ce4a285fb6ca1580734e" dependencies = [ - "rustix 0.36.12", + "rustix 0.37.19", "tempfile", - "windows-sys 0.45.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "atspi" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674e7a3376837b2e7d12d34d58ac47073c491dc3bf6f71a7adaf687d4d817faa" +dependencies = [ + "async-recursion", + "async-trait", + "atspi-macros", + "enumflags2", + "futures-lite", + "serde", + "tracing", + "zbus", + "zbus_names", +] + +[[package]] +name = "atspi-macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb4870a32c0eaa17e35bca0e6b16020635157121fb7d45593d242c295bc768" +dependencies = [ + "quote", + "syn 1.0.109", ] [[package]] @@ -257,12 +334,33 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide 0.6.2", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + [[package]] name = "bit-set" version = "0.5.3" @@ -290,6 +388,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" + [[package]] name = "block" version = "0.1.6" @@ -351,9 +455,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytemuck" @@ -372,7 +476,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -408,11 +512,12 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-expr" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6" +checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9" dependencies = [ "smallvec", + "target-lexicon", ] [[package]] @@ -429,13 +534,13 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time 0.1.45", "wasm-bindgen", @@ -448,7 +553,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -464,7 +569,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -489,6 +594,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" + [[package]] name = "concurrent-queue" version = "2.2.0" @@ -500,9 +611,9 @@ dependencies = [ [[package]] name = "const_panic" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58baae561b85ca19b3122a9ddd35c8ec40c3bcd14fe89921824eae73f7baffbf" +checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" [[package]] name = "core-foundation" @@ -526,7 +637,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -539,7 +650,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types", "libc", @@ -551,6 +662,7 @@ version = "0.1.0" dependencies = [ "anyhow", "calloop", + "cosmic-applet", "cosmic-client-toolkit", "cosmic-protocols", "freedesktop-desktop-entry", @@ -564,9 +676,11 @@ dependencies = [ "log", "nix 0.26.2", "once_cell", - "pretty_env_logger", + "pretty_env_logger 0.5.0", + "rand", "ron", "rust-embed", + "rust-embed-utils", "serde", "shlex", "tokio", @@ -574,16 +688,32 @@ dependencies = [ "xdg", ] +[[package]] +name = "cosmic-applet" +version = "0.1.0" +dependencies = [ + "cosmic-panel-config", + "libcosmic", + "ron", + "serde", +] + [[package]] name = "cosmic-applet-audio" version = "0.1.0" dependencies = [ + "cosmic-applet", + "i18n-embed", + "i18n-embed-fl", "icon-loader", "libcosmic", "libpulse-binding", "libpulse-glib-binding", "log", - "pretty_env_logger", + "once_cell", + "pretty_env_logger 0.4.0", + "rust-embed", + "rust-embed-utils", "tokio", ] @@ -591,13 +721,14 @@ dependencies = [ name = "cosmic-applet-battery" version = "0.1.0" dependencies = [ + "cosmic-applet", "futures", "i18n-embed", "i18n-embed-fl", "libcosmic", "log", "once_cell", - "pretty_env_logger", + "pretty_env_logger 0.5.0", "rust-embed", "tokio", "zbus", @@ -609,6 +740,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bluer", + "cosmic-applet", "futures", "futures-util", "i18n-embed", @@ -617,7 +749,7 @@ dependencies = [ "libcosmic", "log", "once_cell", - "pretty_env_logger", + "pretty_env_logger 0.5.0", "rand", "rust-embed", "slotmap", @@ -628,6 +760,7 @@ dependencies = [ name = "cosmic-applet-graphics" version = "0.1.0" dependencies = [ + "cosmic-applet", "i18n-embed", "i18n-embed-fl", "libcosmic", @@ -641,6 +774,7 @@ name = "cosmic-applet-network" version = "0.1.0" dependencies = [ "anyhow", + "cosmic-applet", "cosmic-dbus-networkmanager", "futures", "futures-util", @@ -650,8 +784,9 @@ dependencies = [ "libcosmic", "log", "once_cell", - "pretty_env_logger", + "pretty_env_logger 0.5.0", "rust-embed", + "rust-embed-utils", "slotmap", "tokio", "zbus", @@ -661,6 +796,7 @@ dependencies = [ name = "cosmic-applet-notifications" version = "0.1.0" dependencies = [ + "cosmic-applet", "icon-loader", "libcosmic", "nix 0.24.3", @@ -670,12 +806,18 @@ dependencies = [ name = "cosmic-applet-power" version = "0.1.0" dependencies = [ + "cosmic-applet", + "i18n-embed", + "i18n-embed-fl", "icon-loader", "libcosmic", "libpulse-binding", "libpulse-glib-binding", "logind-zbus", "nix 0.26.2", + "once_cell", + "rust-embed", + "rust-embed-utils", "tokio", "zbus", ] @@ -685,6 +827,7 @@ name = "cosmic-applet-time" version = "0.1.0" dependencies = [ "chrono", + "cosmic-applet", "icon-loader", "libcosmic", "nix 0.24.3", @@ -696,6 +839,7 @@ version = "0.1.0" dependencies = [ "anyhow", "calloop", + "cosmic-applet", "cosmic-client-toolkit", "cosmic-protocols", "futures", @@ -705,44 +849,55 @@ dependencies = [ "log", "nix 0.26.2", "once_cell", - "pretty_env_logger", + "pretty_env_logger 0.5.0", "rust-embed", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "xdg", ] [[package]] name = "cosmic-client-toolkit" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols#7d80b59afc464a8ecdb8001333f18de554f299f4" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=f0cfe09#f0cfe0973376b31fba4a726a35633a8e39e9319e" dependencies = [ "cosmic-protocols", "smithay-client-toolkit 0.17.0", - "wayland-client 0.30.1", + "wayland-client 0.30.2", ] [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "atomicwrites", - "dirs 4.0.0", + "cosmic-config-derive", + "dirs 5.0.1", + "iced_futures", "notify", "ron", "serde", ] +[[package]] +name = "cosmic-config-derive" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "cosmic-dbus-networkmanager" version = "0.1.0" source = "git+https://github.com/pop-os/dbus-settings-bindings?branch=main#dd3d4935a9e10eac592a974b561c71030ac40c3b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "derive_builder", "procfs", - "time 0.3.20", + "time 0.3.21", "zbus", "zvariant", ] @@ -751,6 +906,7 @@ dependencies = [ name = "cosmic-panel-button" version = "0.1.0" dependencies = [ + "cosmic-applet", "freedesktop-desktop-entry", "libcosmic", ] @@ -758,7 +914,7 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#2227432ccf4d378b517fc1707d3bb287a1d4751e" +source = "git+https://github.com/pop-os/cosmic-panel?rev=11cfff0#11cfff080cf22fc2073fe42feca82afc88eef16e" dependencies = [ "anyhow", "cosmic-config", @@ -772,11 +928,11 @@ dependencies = [ [[package]] name = "cosmic-protocols" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols#7d80b59afc464a8ecdb8001333f18de554f299f4" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=f0cfe09#f0cfe0973376b31fba4a726a35633a8e39e9319e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "wayland-protocols 0.30.0", "wayland-scanner 0.30.0", "wayland-server", @@ -784,15 +940,15 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.7.0" -source = "git+https://github.com/pop-os/cosmic-text?rev=e788c175#e788c175ec31094b04dcacbc0537dba4433afcfc" +version = "0.8.0" +source = "git+https://github.com/hecrj/cosmic-text.git?rev=b85d6a4f2376f8a8a7dadc0f8bcb89d4db10a1c9#b85d6a4f2376f8a8a7dadc0f8bcb89d4db10a1c9" dependencies = [ - "fontdb 0.13.0", + "fontdb", "libm", "log", "ouroboros 0.15.6", "rangemap", - "rustybuzz 0.7.0", + "rustybuzz", "swash", "sys-locale", "unicode-bidi", @@ -804,9 +960,10 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-theme.git#a1258308a894c5c7bbe6e261271e8476d55955d3" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "anyhow", + "cosmic-config", "csscolorparser", "directories", "lazy_static", @@ -817,9 +974,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] @@ -835,9 +992,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -902,6 +1059,12 @@ dependencies = [ "serde", ] +[[package]] +name = "cursor-icon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf" + [[package]] name = "custom_debug" version = "0.5.1" @@ -922,71 +1085,17 @@ dependencies = [ "synstructure", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.13", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.13", -] - [[package]] name = "d3d12" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" dependencies = [ - "bitflags", - "libloading", + "bitflags 1.3.2", + "libloading 0.7.4", "winapi", ] -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.14.4" @@ -998,17 +1107,13 @@ dependencies = [ ] [[package]] -name = "darling_core" -version = "0.10.2" +name = "darling" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn 1.0.109", + "darling_core 0.20.1", + "darling_macro 0.20.1", ] [[package]] @@ -1021,19 +1126,22 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", + "strsim", "syn 1.0.109", ] [[package]] -name = "darling_macro" -version = "0.10.2" +name = "darling_core" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" dependencies = [ - "darling_core 0.10.2", + "fnv", + "ident_case", + "proc-macro2", "quote", - "syn 1.0.109", + "strsim", + "syn 2.0.18", ] [[package]] @@ -1047,6 +1155,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_macro" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +dependencies = [ + "darling_core 0.20.1", + "quote", + "syn 2.0.18", +] + [[package]] name = "dashmap" version = "5.4.0" @@ -1054,7 +1173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.12.3", "lock_api", "once_cell", "parking_lot_core 0.9.7", @@ -1062,12 +1181,9 @@ dependencies = [ [[package]] name = "data-url" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" -dependencies = [ - "matches", -] +checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" [[package]] name = "dbus" @@ -1146,21 +1262,21 @@ dependencies = [ [[package]] name = "derive_setters" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1cf41b4580a37cca5ef2ada2cc43cf5d6be3983f4522e83010d67ab6925e84b" +checksum = "4e8ef033054e131169b8f0f9a7af8f5533a9436fadf3c500ed547f730f07090d" dependencies = [ - "darling 0.10.2", + "darling 0.20.1", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -1172,7 +1288,7 @@ version = "4.0.1" source = "git+https://github.com/edfloreshz/directories-rs#6a6d83d853a35ee3273034215c4defaf61286fe5" dependencies = [ "anyhow", - "dirs-sys", + "dirs-sys 0.3.7", ] [[package]] @@ -1181,7 +1297,7 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" dependencies = [ - "dirs-sys", + "dirs-sys 0.3.7", ] [[package]] @@ -1190,7 +1306,16 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ - "dirs-sys", + "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", ] [[package]] @@ -1205,14 +1330,26 @@ dependencies = [ ] [[package]] -name = "displaydoc" -version = "0.2.3" +name = "dirs-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -1221,7 +1358,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" dependencies = [ - "libloading", + "libloading 0.7.4", ] [[package]] @@ -1287,9 +1424,9 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0044ebdf7fbb2a772e0c0233a9d3173c5cd8af8ae7078d4c5188af44ffffaa4b" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" dependencies = [ "enumflags2_derive", "serde", @@ -1297,13 +1434,13 @@ dependencies = [ [[package]] name = "enumflags2_derive" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2c772ccdbdfd1967b4f5d79d17c98ebf92009fdcc838db7aa434462f600c26" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -1313,7 +1450,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime 2.1.0", + "is-terminal", "log", "regex", "termcolor", @@ -1321,13 +1471,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1340,6 +1490,16 @@ dependencies = [ "libc", ] +[[package]] +name = "etagere" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6301151a318f367f392c31395beb1cfba5ccd9abc44d1db0db3a4b27b9601c89" +dependencies = [ + "euclid", + "svg_fmt", +] + [[package]] name = "euclid" version = "0.22.9" @@ -1365,7 +1525,7 @@ dependencies = [ "flume", "half", "lebe", - "miniz_oxide", + "miniz_oxide 0.6.2", "rayon-core", "smallvec", "zune-inflate", @@ -1380,6 +1540,15 @@ dependencies = [ "instant", ] +[[package]] +name = "fdeflate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" +dependencies = [ + "simd-adler32", +] + [[package]] name = "filetime" version = "0.2.21" @@ -1403,12 +1572,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -1484,26 +1653,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fontdb" -version = "0.6.2" +name = "fontconfig-parser" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d66551cc28351f0bc6a73da86459ee7765caaad03ce284f2dc36472dbf539cd" +checksum = "4ab2e12762761366dcb876ab8b6e0cfa4797ddcd890575919f008b5ba655672a" dependencies = [ - "log", - "memmap2 0.3.1", - "ttf-parser 0.12.3", + "roxmltree", ] [[package]] name = "fontdb" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfec8f19f9b89b2901219cc62604810d2bfef15dc1182e95320f57e7cbbe041a" +checksum = "237ff9f0813bbfc9de836016472e0c9ae7802f174a51594607e5f4ff334cb2f5" dependencies = [ + "fontconfig-parser", "log", - "memmap2 0.5.10", + "memmap2", "slotmap", - "ttf-parser 0.18.1", + "ttf-parser", ] [[package]] @@ -1647,7 +1815,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -1680,15 +1848,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1752,6 +1911,12 @@ dependencies = [ "weezl", ] +[[package]] +name = "gimli" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" + [[package]] name = "glam" version = "0.21.3" @@ -1760,11 +1925,11 @@ checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815" [[package]] name = "glib" -version = "0.17.5" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb53061756195d76969292c2d2e329e01259276524a9bae6c9b73af62854773" +checksum = "a7f1de7cbde31ea4f0a919453a2dcece5d54d5b70e08f8ad254dc4840f5f09b6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-executor", @@ -1782,9 +1947,9 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.17.7" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4cf346122086f196260783aa58987190dbd5f43bfab01946d2bf9786e8d9ef" +checksum = "0a7206c5c03851ef126ea1444990e81fdd6765fb799d5bc694e4897ca01bb97f" dependencies = [ "anyhow", "heck", @@ -1807,9 +1972,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "4e007a07a24de5ecae94160f141029e9a347282cfe25d1d58d85d845cf3130f1" dependencies = [ "js-sys", "slotmap", @@ -1818,53 +1983,14 @@ dependencies = [ ] [[package]] -name = "glow_glyph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4e62c64947b9a24fe20e2bba9ad819ecb506ef5c8df7ffc4737464c6df9510" +name = "glyphon" +version = "0.2.0" +source = "git+https://github.com/hecrj/glyphon.git?rev=f145067d292082abdd1f2b2481812d4a52c394ec#f145067d292082abdd1f2b2481812d4a52c394ec" dependencies = [ - "bytemuck", - "glow", - "glyph_brush", - "log", -] - -[[package]] -name = "glyph_brush" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4edefd123f28a0b1d41ec4a489c2b43020b369180800977801611084f342978d" -dependencies = [ - "glyph_brush_draw_cache", - "glyph_brush_layout", - "ordered-float", - "rustc-hash", - "twox-hash", -] - -[[package]] -name = "glyph_brush_draw_cache" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6010675390f6889e09a21e2c8b575b3ee25667ea8237a8d59423f73cb8c28610" -dependencies = [ - "ab_glyph", - "crossbeam-channel", - "crossbeam-deque", - "linked-hash-map", - "rayon", - "rustc-hash", -] - -[[package]] -name = "glyph_brush_layout" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" -dependencies = [ - "ab_glyph", - "approx", - "xi-unicode", + "cosmic-text", + "etagere", + "lru", + "wgpu", ] [[package]] @@ -1880,11 +2006,11 @@ dependencies = [ [[package]] name = "gpu-alloc" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" +checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gpu-alloc-types", ] @@ -1894,7 +2020,20 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "gpu-allocator" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" +dependencies = [ + "backtrace", + "log", + "thiserror", + "winapi", + "windows 0.44.0", ] [[package]] @@ -1903,9 +2042,9 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1914,7 +2053,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1942,7 +2081,31 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] + +[[package]] +name = "hassle-rs" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" +dependencies = [ + "bitflags 1.3.2", + "com-rs", + "libc", + "libloading 0.7.4", + "thiserror", + "widestring", + "winapi", ] [[package]] @@ -1987,6 +2150,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "humantime" version = "1.3.0" @@ -1997,24 +2169,30 @@ dependencies = [ ] [[package]] -name = "i18n-config" -version = "0.4.3" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d9f93ceee6543011739bc81699b5e0cf1f23f3a80364649b6d80de8636bc8df" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "i18n-config" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b987084cadad6e2f2b1e6ea62c44123591a3c044793a1beabf71a8356ea768d5" dependencies = [ "log", "serde", "serde_derive", "thiserror", - "toml 0.5.11", + "toml 0.7.3", "unic-langid", ] [[package]] name = "i18n-embed" -version = "0.13.8" +version = "0.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2653dd1a8be0726315603f1c180b29f90e5b2a58f8b943d949d5170d9ad81101" +checksum = "92a86226a7a16632de6723449ee5fe70bac5af718bc642ee9ca2f0f6e14fa1fa" dependencies = [ "arc-swap", "fluent", @@ -2034,9 +2212,9 @@ dependencies = [ [[package]] name = "i18n-embed-fl" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b5809e2295beeb55013705c3b947cbbe83b8cadf3c73a1e6dca06381927212a" +checksum = "d26a3d3569737dfaac7fc1c4078e6af07471c3060b8e570bcd83cdd5f4685395" dependencies = [ "dashmap", "find-crate", @@ -2048,16 +2226,16 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn 2.0.18", "unic-langid", ] [[package]] name = "i18n-embed-impl" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db2330e035808eb064afb67e6743ddce353763af3e0f2bdfc2476e00ce76136" +checksum = "e9a95d065e6be4499e50159172395559a388d20cf13c84c77e4a1e341786f219" dependencies = [ "find-crate", "i18n-config", @@ -2077,142 +2255,124 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows 0.48.0", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "iced" -version = "0.6.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +version = "0.9.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ + "iced_accessibility", "iced_core", - "iced_dyrend", "iced_futures", - "iced_glow", - "iced_graphics", - "iced_native", + "iced_renderer", "iced_sctk", - "iced_softbuffer", - "iced_wgpu", + "iced_widget", "image", "thiserror", ] [[package]] -name = "iced_core" -version = "0.6.2" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +name = "iced_accessibility" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ - "bitflags", - "palette", - "wasm-timer", + "accesskit", + "accesskit_unix", ] [[package]] -name = "iced_dyrend" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +name = "iced_core" +version = "0.9.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ - "iced_glow", - "iced_graphics", - "iced_native", - "iced_softbuffer", - "iced_wgpu", + "bitflags 1.3.2", + "iced_accessibility", + "instant", "log", - "raw-window-handle", + "palette", + "smithay-client-toolkit 0.17.0", + "thiserror", + "twox-hash", ] [[package]] name = "iced_futures" -version = "0.5.1" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +version = "0.6.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "futures", + "iced_core", "log", "tokio", "wasm-bindgen-futures", "wasm-timer", ] -[[package]] -name = "iced_glow" -version = "0.5.1" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" -dependencies = [ - "bytemuck", - "euclid", - "glow", - "glow_glyph", - "glyph_brush", - "iced_graphics", - "iced_native", - "log", -] - [[package]] name = "iced_graphics" -version = "0.5.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +version = "0.8.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytemuck", "glam", - "iced_native", - "iced_style", + "iced_core", "image", "kamadak-exif", "log", "raw-window-handle", - "resvg", "thiserror", "tiny-skia", - "usvg", ] [[package]] -name = "iced_lazy" -version = "0.3.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +name = "iced_renderer" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ - "iced_native", - "ouroboros 0.13.0", + "iced_graphics", + "iced_tiny_skia", + "iced_wgpu", + "raw-window-handle", + "thiserror", ] [[package]] -name = "iced_native" -version = "0.7.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +name = "iced_runtime" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ + "iced_accessibility", "iced_core", "iced_futures", - "iced_style", - "num-traits", "smithay-client-toolkit 0.17.0", - "twox-hash", - "unicode-segmentation", + "thiserror", ] [[package]] name = "iced_sctk" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "enum-repr", "float-cmp", "futures", "iced_futures", "iced_graphics", - "iced_native", + "iced_runtime", + "iced_style", + "itertools", "log", "raw-window-handle", "smithay-client-toolkit 0.17.0", @@ -2221,25 +2381,10 @@ dependencies = [ "wayland-backend", ] -[[package]] -name = "iced_softbuffer" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" -dependencies = [ - "cosmic-text", - "iced_graphics", - "iced_native", - "lazy_static", - "log", - "raqote", - "raw-window-handle", - "softbuffer", -] - [[package]] name = "iced_style" -version = "0.5.1" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +version = "0.8.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "iced_core", "once_cell", @@ -2247,23 +2392,58 @@ dependencies = [ ] [[package]] -name = "iced_wgpu" -version = "0.7.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +name = "iced_tiny_skia" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ - "bitflags", + "bytemuck", + "cosmic-text", + "iced_graphics", + "kurbo", + "log", + "raw-window-handle", + "resvg", + "rustc-hash", + "softbuffer", + "tiny-skia", + "twox-hash", +] + +[[package]] +name = "iced_wgpu" +version = "0.10.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +dependencies = [ + "bitflags 1.3.2", "bytemuck", "encase", "futures", "glam", - "glyph_brush", + "glyphon", "guillotiere", "iced_graphics", - "iced_native", "log", + "once_cell", "raw-window-handle", + "resvg", + "rustc-hash", + "twox-hash", "wgpu", - "wgpu_glyph", +] + +[[package]] +name = "iced_widget" +version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +dependencies = [ + "iced_renderer", + "iced_runtime", + "iced_style", + "num-traits", + "ouroboros 0.13.0", + "smithay-client-toolkit 0.17.0", + "thiserror", + "unicode-segmentation", ] [[package]] @@ -2304,7 +2484,7 @@ dependencies = [ "color_quant", "exr", "gif", - "jpeg-decoder 0.3.0", + "jpeg-decoder", "num-rational", "num-traits", "png", @@ -2312,6 +2492,12 @@ dependencies = [ "tiff", ] +[[package]] +name = "imagesize" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72ad49b554c1728b1e83254a1b1565aea4161e28dabbfa171fc15fe62299caf" + [[package]] name = "indexmap" version = "1.9.3" @@ -2319,7 +2505,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -2328,7 +2514,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "inotify-sys", "libc", ] @@ -2372,15 +2558,27 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", "windows-sys 0.48.0", ] +[[package]] +name = "is-terminal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix 0.37.19", + "windows-sys 0.48.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -2396,12 +2594,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" - [[package]] name = "jpeg-decoder" version = "0.3.0" @@ -2413,9 +2605,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" dependencies = [ "wasm-bindgen", ] @@ -2436,7 +2628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" dependencies = [ "libc", - "libloading", + "libloading 0.7.4", "pkg-config", ] @@ -2456,17 +2648,17 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", ] [[package]] name = "kurbo" -version = "0.8.0" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb348d766edbac91ba1eb83020d96f4f8867924d194393083c15a51f185e6a82" +checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" dependencies = [ - "arrayvec 0.5.2", + "arrayvec", ] [[package]] @@ -2483,27 +2675,27 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#93ec06a34dde0122f474e7adaec885b5cb8dab5e" +source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" dependencies = [ "apply", - "cosmic-panel-config", + "cosmic-config", "cosmic-theme", "derive_setters", "fraction", "freedesktop-icons", "iced", "iced_core", - "iced_lazy", - "iced_native", + "iced_runtime", "iced_sctk", "iced_style", + "iced_widget", "lazy_static", "palette", "slotmap", @@ -2513,9 +2705,9 @@ dependencies = [ [[package]] name = "libdbus-sys" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8d7ae751e1cb825c840ae5e682f59b098cdfd213c350ac268b61449a5f58a0" +checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" dependencies = [ "pkg-config", ] @@ -2531,10 +2723,20 @@ dependencies = [ ] [[package]] -name = "libm" -version = "0.2.6" +name = "libloading" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libpulse-binding" @@ -2542,7 +2744,7 @@ version = "2.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1745b20bfc194ac12ef828f144f0ec2d4a7fe993281fa3567a0bd4969aee6890" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libpulse-sys", "num-derive", @@ -2586,21 +2788,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -2609,9 +2796,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.3.1" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "locale_config" @@ -2638,12 +2825,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "logind-zbus" @@ -2656,14 +2840,12 @@ dependencies = [ ] [[package]] -name = "lyon_geom" -version = "0.17.7" +name = "lru" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d89ccbdafd83d259403e22061be27bccc3254bba65cdc5303250c4227c8c8e" +checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" dependencies = [ - "arrayvec 0.5.2", - "euclid", - "num-traits", + "hashbrown 0.13.2", ] [[package]] @@ -2681,27 +2863,12 @@ dependencies = [ "libc", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmap2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.5.10" @@ -2744,7 +2911,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-graphics-types", "foreign-types", @@ -2768,15 +2935,25 @@ dependencies = [ ] [[package]] -name = "mio" -version = "0.8.6" +name = "miniz_oxide" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2787,12 +2964,12 @@ checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" [[package]] name = "naga" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" +checksum = "80cd00bd6180a8790f1c020ed258a46b8d73dd5bd6af104a238c9d71f806938e" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "codespan-reporting", "hexf-parse", "indexmap", @@ -2820,7 +2997,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -2833,7 +3010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -2845,7 +3022,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.7.1", @@ -2865,11 +3042,11 @@ dependencies = [ [[package]] name = "notify" -version = "5.1.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ea850aa68a06e48fdb069c0ec44d0d64c8dbffa49bf3b6f7f0a901fdea1ba9" +checksum = "4d9ba6c734de18ca27c8cef5cd7058aa4ac9f63596131e4c7e41e579319032a2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossbeam-channel", "filetime", "fsevent-sys", @@ -2878,7 +3055,7 @@ dependencies = [ "libc", "mio", "walkdir", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3018,19 +3195,25 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.17.1" +name = "object" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +dependencies = [ + "memchr", +] [[package]] -name = "ordered-float" -version = "3.6.0" +name = "once_cell" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a384337e997e6860ffbaa83708b2ef329fd8c54cb67a5f64d421e0f943254f" -dependencies = [ - "num-traits", -] +checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-multimap" @@ -3039,7 +3222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" dependencies = [ "dlv-list", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -3099,15 +3282,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "owned_ttf_parser" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25e9fb15717794fae58ab55c26e044103aad13186fbb625893f9a3bbcc24228" -dependencies = [ - "ttf-parser 0.18.1", -] - [[package]] name = "palette" version = "0.6.1" @@ -3237,28 +3411,28 @@ dependencies = [ [[package]] name = "pico-args" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -3275,30 +3449,31 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "png" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" +checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", + "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] name = "polling" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", @@ -3319,7 +3494,17 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ - "env_logger", + "env_logger 0.7.1", + "log", +] + +[[package]] +name = "pretty_env_logger" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" +dependencies = [ + "env_logger 0.10.0", "log", ] @@ -3359,9 +3544,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -3372,18 +3557,18 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de8dacb0873f77e6aefc6d71e044761fcc68060290f5b1089fcdf84626bb69" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "hex", "lazy_static", - "rustix 0.36.12", + "rustix 0.36.14", ] [[package]] name = "profiling" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df" +checksum = "332cd62e95873ea4f41f3dfd6bbbfc5b52aec892d7e8d534197c4720a0bbbab2" [[package]] name = "qoi" @@ -3411,9 +3596,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -3460,18 +3645,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9283c6b06096b47afc7109834fdedab891175bb5241ee5d4f7d2546549f263" -[[package]] -name = "raqote" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5b6cb89f8be6a645e5834f3ad44a7960d12343d97b5b7fb07cb0365ae36aa2d" -dependencies = [ - "euclid", - "lyon_geom", - "sw-composite", - "typed-arena", -] - [[package]] name = "raw-window-handle" version = "0.5.2" @@ -3502,9 +3675,9 @@ dependencies = [ [[package]] name = "rctree" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae028b272a6e99d9f8260ceefa3caa09300a8d6c8d2b2001316474bc52122e9" +checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" [[package]] name = "redox_syscall" @@ -3512,7 +3685,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3521,7 +3694,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -3537,9 +3710,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" dependencies = [ "aho-corasick", "memchr", @@ -3548,28 +3721,30 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "renderdoc-sys" -version = "0.7.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" +checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" [[package]] name = "resvg" -version = "0.18.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608c6e8aa6fb2c13bc06e4184d7c7b2cc1b7c138f88a539da8be55c3c033d7f4" +checksum = "142e83d8ae8c8c639f304698a5567b229ba65caba867bf4387bbc0ae158827cf" dependencies = [ - "jpeg-decoder 0.1.22", + "gif", + "jpeg-decoder", "log", "pico-args", "png", "rgb", "svgfilters", + "svgtypes", "tiny-skia", "usvg", ] @@ -3589,16 +3764,29 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" dependencies = [ - "base64", - "bitflags", + "base64 0.13.1", + "bitflags 1.3.2", "serde", ] [[package]] -name = "roxmltree" -version = "0.14.1" +name = "rosvgtree" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b" +checksum = "ad747e7384940e7bf33b15ba433b7bad9f44c0c6d5287a67c2cb22cd1743d497" +dependencies = [ + "log", + "roxmltree", + "simplecss", + "siphasher", + "svgtypes", +] + +[[package]] +name = "roxmltree" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f595a457b6b8c6cda66a48503e92ee8d19342f905948f29c383200ec9eb1d8" dependencies = [ "xmlparser", ] @@ -3647,6 +3835,12 @@ dependencies = [ "ordered-multimap", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -3655,11 +3849,11 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.36.12" +version = "0.36.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0af200a3324fa5bcd922e84e9b55a298ea9f431a489f01961acdebc6e908f25" +checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -3669,15 +3863,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.9" +version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3eb76a3b09109e78c52d45979fea3cd8ddaadb223531d0846bedb60e72c3e99" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys 0.3.1", + "linux-raw-sys 0.3.8", "windows-sys 0.48.0", ] @@ -3687,36 +3881,20 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" -[[package]] -name = "rustybuzz" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44561062e583c4873162861261f16fd1d85fe927c4904d71329a4fe43dc355ef" -dependencies = [ - "bitflags", - "bytemuck", - "smallvec", - "ttf-parser 0.12.3", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-general-category 0.4.0", - "unicode-script", -] - [[package]] name = "rustybuzz" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162bdf42e261bee271b3957691018634488084ef577dddeb6420a9684cab2a6a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytemuck", "libm", "smallvec", - "ttf-parser 0.18.1", + "ttf-parser", "unicode-bidi-mirroring", "unicode-ccc", - "unicode-general-category 0.6.0", + "unicode-general-category", "unicode-script", ] @@ -3726,15 +3904,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" -[[package]] -name = "safe_arch" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" -dependencies = [ - "bytemuck", -] - [[package]] name = "same-file" version = "1.0.6" @@ -3756,12 +3925,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "self_cell" version = "0.10.2" @@ -3770,29 +3933,29 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" [[package]] name = "serde" -version = "1.0.159" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.159" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -3807,14 +3970,14 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" dependencies = [ "serde", ] @@ -3847,6 +4010,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +[[package]] +name = "signal-hook" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +dependencies = [ + "libc", + "signal-hook-registry", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3907,11 +4080,11 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ - "bitflags", + "bitflags 1.3.2", "dlib", "lazy_static", "log", - "memmap2 0.5.10", + "memmap2", "nix 0.24.3", "pkg-config", "wayland-client 0.29.5", @@ -3922,19 +4095,20 @@ dependencies = [ [[package]] name = "smithay-client-toolkit" version = "0.17.0" -source = "git+https://github.com/Smithay/client-toolkit?rev=389a4f2#389a4f21872a99a3ba346cc3dabd55c4079ec191" +source = "git+https://github.com/pop-os/client-toolkit?tag=themed-pointer#fd15dd954bc5f0c78d079aeda7b11194a682bbff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "calloop", + "cursor-icon", "dlib", "lazy_static", "log", - "memmap2 0.5.10", + "memmap2", "nix 0.26.2", "pkg-config", "thiserror", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "wayland-cursor 0.30.0", "wayland-protocols 0.30.0", "wayland-protocols-wlr", @@ -3965,7 +4139,7 @@ dependencies = [ [[package]] name = "softbuffer" version = "0.2.0" -source = "git+https://github.com/pop-os/softbuffer?tag=cosmic-2.0#98b9099f87113c4a4b577de5670ddf41149966b4" +source = "git+https://github.com/pop-os/softbuffer?tag=cosmic-2.0-old#ece901a9f60dc89ca740dc3bd11f3c909e801723" dependencies = [ "bytemuck", "cfg_aliases", @@ -3981,10 +4155,10 @@ dependencies = [ "thiserror", "wasm-bindgen", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "wayland-sys 0.30.1", "web-sys", - "windows-sys 0.45.0", + "windows-sys 0.42.0", "x11-dl", "x11rb", ] @@ -4004,7 +4178,7 @@ version = "0.2.0+1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" dependencies = [ - "bitflags", + "bitflags 1.3.2", "num-traits", ] @@ -4021,10 +4195,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "strsim" -version = "0.9.3" +name = "strict-num" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] [[package]] name = "strsim" @@ -4072,24 +4249,19 @@ dependencies = [ [[package]] name = "svgtypes" -version = "0.8.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22975e8a2bac6a76bb54f898a6b18764633b00e780330f0b689f65afb3975564" +checksum = "ed4b0611e7f3277f68c0fa18e385d9e2d26923691379690039548f867cef02a7" dependencies = [ + "kurbo", "siphasher", ] -[[package]] -name = "sw-composite" -version = "0.7.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac8fb7895b4afa060ad731a32860db8755da3449a47e796d5ecf758db2671d4" - [[package]] name = "swash" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb18e5888a9b5f0a89ea3ebdf6883dc479347ca9183b6c51a8f9cf2041f23a0" +checksum = "3b7c73c813353c347272919aa1af2885068b05e625e5532b43049e4f641ae77f" dependencies = [ "yazi", "zeno", @@ -4108,9 +4280,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -4131,22 +4303,19 @@ dependencies = [ [[package]] name = "sys-locale" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee" +checksum = "ea0b9eefabb91675082b41eb94c3ecd91af7656caee3fb4961a07c0ec8c7ca6f" dependencies = [ - "js-sys", "libc", - "wasm-bindgen", - "web-sys", "windows-sys 0.45.0", ] [[package]] name = "system-deps" -version = "6.0.4" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f" +checksum = "e5fa6fb9ee296c0dc2df41a656ca7948546d061958115ddb0bcaae43ad0d17d2" dependencies = [ "cfg-expr", "heck", @@ -4155,6 +4324,12 @@ dependencies = [ "version-compare", ] +[[package]] +name = "target-lexicon" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" + [[package]] name = "temp-dir" version = "0.1.11" @@ -4170,7 +4345,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.9", + "rustix 0.37.19", "windows-sys 0.45.0", ] @@ -4200,7 +4375,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -4210,7 +4385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7449334f9ff2baf290d55d73983a7d6fa15e01198faef72af07e2a8db851e471" dependencies = [ "flate2", - "jpeg-decoder 0.3.0", + "jpeg-decoder", "weezl", ] @@ -4227,9 +4402,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" dependencies = [ "serde", "time-core", @@ -4237,22 +4412,34 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "tiny-skia" -version = "0.6.6" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d049bfef0eaa2521e75d9ffb5ce86ad54480932ae19b85f78bec6f52c4d30d78" +checksum = "ce2986c82f77818c7b9144c70818fdde98db15308e329ae2f7204d767808fd3c" dependencies = [ "arrayref", - "arrayvec 0.5.2", + "arrayvec", "bytemuck", "cfg-if", + "log", "png", - "safe_arch", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7acb0ccda1ac91084353a56d0b69b0e29c311fd809d2088b1ed2f9ae1841c47" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", ] [[package]] @@ -4281,9 +4468,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -4296,25 +4483,25 @@ dependencies = [ "socket2", "tokio-macros", "tracing", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] name = "tokio-stream" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", @@ -4344,9 +4531,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" dependencies = [ "serde", ] @@ -4378,30 +4565,24 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] -[[package]] -name = "ttf-parser" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6" - [[package]] name = "ttf-parser" version = "0.18.1" @@ -4428,12 +4609,6 @@ dependencies = [ "rustc-hash", ] -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - [[package]] name = "typenum" version = "1.16.0" @@ -4487,12 +4662,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" -[[package]] -name = "unicode-general-category" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07547e3ee45e28326cc23faac56d44f58f16ab23e413db526debce3b0bfd2742" - [[package]] name = "unicode-general-category" version = "0.6.0" @@ -4501,9 +4670,9 @@ checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-linebreak" @@ -4511,7 +4680,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", "regex", ] @@ -4567,36 +4736,69 @@ dependencies = [ [[package]] name = "usvg" -version = "0.18.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4058e0bd091a56f905e6963e40776ce6880b271275f0b493bff951433e303071" +checksum = "4b44e14b7678bcc5947b397991432d0c4e02a103958a0ed5e1b9b961ddd08b21" dependencies = [ - "base64", - "data-url", - "flate2", - "float-cmp", - "fontdb 0.6.2", - "kurbo", + "base64 0.21.2", "log", "pico-args", - "rctree", - "roxmltree", - "rustybuzz 0.4.0", - "simplecss", - "siphasher", - "svgtypes", - "ttf-parser 0.12.3", - "unicode-bidi", - "unicode-script", - "unicode-vo", + "usvg-parser", + "usvg-text-layout", + "usvg-tree", "xmlwriter", ] [[package]] -name = "uuid" -version = "1.3.0" +name = "usvg-parser" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "90c8251d965c2882a636ffcc054340b1f13a6bce68779cb5b2084d8ffc2535be" +dependencies = [ + "data-url", + "flate2", + "imagesize", + "kurbo", + "log", + "rosvgtree", + "strict-num", + "svgtypes", + "usvg-tree", +] + +[[package]] +name = "usvg-text-layout" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c4fed019d1af07bfe0f3bac13d120d7b51bc65b38cb24809cf4ed0b8b631138" +dependencies = [ + "fontdb", + "kurbo", + "log", + "rustybuzz", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "usvg-tree", +] + +[[package]] +name = "usvg-tree" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7371265c467cdae0ccc3655e2e3f310c695fb9f717c0d25187bf3b333f7b5159" +dependencies = [ + "kurbo", + "rctree", + "strict-num", + "svgtypes", +] + +[[package]] +name = "uuid" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" dependencies = [ "getrandom", ] @@ -4649,9 +4851,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4659,24 +4861,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" dependencies = [ "cfg-if", "js-sys", @@ -4686,9 +4888,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4696,22 +4898,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-timer" @@ -4730,9 +4932,9 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ebd48bfc1178c9190c7ff80cc822b3335ffc83141e9aa723168f377257623e" +checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" dependencies = [ "cc", "downcast-rs", @@ -4749,7 +4951,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix 0.24.3", @@ -4761,11 +4963,11 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.30.1" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bde68449abab1a808e5227b6e295f4ae3680911eb7711b4a2cb90141edb780" +checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "calloop", "nix 0.26.2", "wayland-backend", @@ -4802,7 +5004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d0c3a0d5b4b688b07b0442362d3ed6bf04724fcc16cd69ab6285b90dbc487aa" dependencies = [ "nix 0.26.2", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "xcursor", ] @@ -4812,7 +5014,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client 0.29.5", "wayland-commons", "wayland-scanner 0.29.5", @@ -4824,9 +5026,9 @@ version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fefbeb8a360abe67ab7c2efe1d297a1a50ee011f5460791bc18870c26bb84e2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "wayland-scanner 0.30.0", "wayland-server", ] @@ -4837,9 +5039,9 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-backend", - "wayland-client 0.30.1", + "wayland-client 0.30.2", "wayland-protocols 0.30.0", "wayland-scanner 0.30.0", "wayland-server", @@ -4869,11 +5071,11 @@ dependencies = [ [[package]] name = "wayland-server" -version = "0.30.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9062def387c1b1d80e366d8243c2b3bd6d9e4f343032a3e5da8d4aa03866cf89" +checksum = "9c43c28096fe1d49fff7d1079404fdd0f669cd1a5b00c615bdfe71bb1884d23a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "io-lifetimes", "nix 0.26.2", @@ -4906,9 +5108,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" dependencies = [ "js-sys", "wasm-bindgen", @@ -4922,15 +5124,17 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wgpu" -version = "0.14.2" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937" +checksum = "3059ea4ddec41ca14f356833e2af65e7e38c0a8f91273867ed526fb9bafcca95" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", + "cfg-if", "js-sys", "log", "naga", "parking_lot 0.12.1", + "profiling", "raw-window-handle", "smallvec", "static_assertions", @@ -4944,21 +5148,20 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.14.2" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca" +checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "bit-vec", - "bitflags", - "cfg_aliases", + "bitflags 2.3.1", "codespan-reporting", - "fxhash", "log", "naga", "parking_lot 0.12.1", "profiling", "raw-window-handle", + "rustc-hash", "smallvec", "thiserror", "web-sys", @@ -4968,26 +5171,28 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" +checksum = "41af2ea7d87bd41ad0a37146252d5f7c26490209f47f544b2ee3b3ff34c7732e" dependencies = [ "android_system_properties", - "arrayvec 0.7.2", + "arrayvec", "ash", "bit-set", - "bitflags", + "bitflags 2.3.1", "block", "core-graphics-types", "d3d12", "foreign-types", - "fxhash", "glow", "gpu-alloc", + "gpu-allocator", "gpu-descriptor", + "hassle-rs", "js-sys", "khronos-egl", - "libloading", + "libc", + "libloading 0.8.0", "log", "metal", "naga", @@ -4997,6 +5202,7 @@ dependencies = [ "range-alloc", "raw-window-handle", "renderdoc-sys", + "rustc-hash", "smallvec", "thiserror", "wasm-bindgen", @@ -5007,24 +5213,20 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" +checksum = "5bd33a976130f03dcdcd39b3810c0c3fc05daf86f0aaf867db14bfb7c4a9a32b" dependencies = [ - "bitflags", + "bitflags 2.3.1", + "js-sys", + "web-sys", ] [[package]] -name = "wgpu_glyph" -version = "0.18.0" +name = "widestring" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cafb82773e0f124a33674dab5de4dff73175aeb921949047ab014efb58fb446" -dependencies = [ - "bytemuck", - "glyph_brush", - "log", - "wgpu", -] +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -5066,6 +5268,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows" version = "0.48.0" @@ -5250,7 +5461,7 @@ checksum = "cdf3c79412dd91bae7a7366b8ad1565a85e35dd049affc3a6a2c549e97419617" dependencies = [ "gethostname", "libc", - "libloading", + "libloading 0.7.4", "nix 0.25.1", "once_cell", "winapi", @@ -5278,28 +5489,32 @@ dependencies = [ [[package]] name = "xdg" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" +checksum = "688597db5a750e9cad4511cb94729a078e274308099a0382b5b8203bbc767fee" dependencies = [ - "dirs 4.0.0", + "home", +] + +[[package]] +name = "xdg-home" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +dependencies = [ + "nix 0.26.2", + "winapi", ] [[package]] name = "xdg-shell-wrapper-config" version = "0.1.0" -source = "git+https://github.com/pop-os/xdg-shell-wrapper#6751f5e32d2d3c01aef2b423975e7b68965d36c1" +source = "git+https://github.com/pop-os/xdg-shell-wrapper?rev=99a9cda#99a9cda4c9f56e0a5208e1a9375af93fd7040d5a" dependencies = [ "serde", "wayland-protocols-wlr", ] -[[package]] -name = "xi-unicode" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" - [[package]] name = "xkbcommon" version = "0.5.0" @@ -5307,14 +5522,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbee136714379ab22da0280207fdb7f47e0bb940adea97731b65598b8c7a92e" dependencies = [ "libc", - "memmap2 0.5.10", + "memmap2", ] [[package]] name = "xml-rs" -version = "0.8.4" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" +checksum = "2d8f380ae16a37b30e6a2cf67040608071384b1450c189e61bea3ff57cde922d" [[package]] name = "xmlparser" @@ -5330,34 +5545,33 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "yazi" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03b3e19c937b5b9bd8e52b1c88f30cce5c0d33d676cf174866175bb794ff658" +checksum = "c94451ac9513335b5e23d7a8a2b61a7102398b8cca5160829d313e84c9d98be1" [[package]] name = "zbus" -version = "3.11.1" +version = "3.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dc29e76f558b2cb94190e8605ecfe77dd40f5df8c072951714b4b71a97f5848" +checksum = "6c3d77c9966c28321f1907f0b6c5a5561189d1f7311eea6d94180c6be9daab29" dependencies = [ "async-broadcast", "async-executor", "async-fs", "async-io", "async-lock", + "async-process", "async-recursion", "async-task", "async-trait", "byteorder", "derivative", - "dirs 4.0.0", "enumflags2", "event-listener", "futures-core", "futures-sink", "futures-util", "hex", - "lazy_static", "nix 0.26.2", "once_cell", "ordered-stream", @@ -5370,6 +5584,7 @@ dependencies = [ "tracing", "uds_windows", "winapi", + "xdg-home", "zbus_macros", "zbus_names", "zvariant", @@ -5377,23 +5592,24 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.11.1" +version = "3.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a80fd82c011cd08459eaaf1fd83d3090c1b61e6d5284360074a7475af3a85d" +checksum = "f6e341d12edaff644e539ccbbf7f161601294c9a84ed3d7e015da33155b435af" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", "regex", "syn 1.0.109", + "winnow", "zvariant_utils", ] [[package]] name = "zbus_names" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34f314916bd89bdb9934154627fab152f4f28acdda03e7c4c68181b214fe7e3" +checksum = "82441e6033be0a741157a72951a3e4957d519698f3a824439cc131c5ba77ac2a" dependencies = [ "serde", "static_assertions", @@ -5408,18 +5624,18 @@ checksum = "c110ba09c9b3a43edd4803d570df0da2414fed6e822e22b976a4e3ef50860701" [[package]] name = "zune-inflate" -version = "0.2.53" +version = "0.2.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "440a08fd59c6442e4b846ea9b10386c38307eae728b216e1ab2c305d1c9daaf8" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" dependencies = [ "simd-adler32", ] [[package]] name = "zvariant" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe4914a985446d6fd287019b5fceccce38303d71407d9e6e711d44954a05d8" +checksum = "622cc473f10cef1b0d73b7b34a266be30ebdcfaea40ec297dd8cbda088f9f93c" dependencies = [ "byteorder", "enumflags2", @@ -5431,9 +5647,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c20260af4b28b3275d6676c7e2a6be0d4332e8e0aba4616d34007fd84e462a" +checksum = "5d9c1b57352c25b778257c661f3c4744b7cefb7fc09dd46909a153cce7773da2" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5444,9 +5660,9 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b22993dbc4d128a17a3b6c92f1c63872dd67198537ee728d8b5d7c40640a8b" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 5dbf38a8..5049bf15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ + "applet", "cosmic-app-list", "cosmic-applet-audio", "cosmic-applet-battery", @@ -15,4 +16,5 @@ members = [ ] [profile.release] -lto = "fat" +lto = "thin" +# lto = "fat" diff --git a/applet/Cargo.toml b/applet/Cargo.toml new file mode 100644 index 00000000..96605472 --- /dev/null +++ b/applet/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "cosmic-applet" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +cosmic = { package = "libcosmic", git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +ron = { version = "0.8" } +serde = { version = "1.0" } +cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", rev = "11cfff0" } diff --git a/applet/src/lib.rs b/applet/src/lib.rs new file mode 100644 index 00000000..af6592bb --- /dev/null +++ b/applet/src/lib.rs @@ -0,0 +1,203 @@ +use cosmic::{ + iced::{self, window, Limits}, + iced_style, iced_widget, sctk, + theme::Button, + Renderer, +}; +use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize}; +use iced::{ + alignment::{Horizontal, Vertical}, + wayland::InitialSurface, + widget::{self, Container}, + Color, Element, Length, Rectangle, Settings, +}; +use iced_style::{button::StyleSheet, container::Appearance}; +use iced_widget::runtime::command::platform_specific::wayland::{ + popup::{SctkPopupSettings, SctkPositioner}, + window::SctkWindowSettings, +}; +use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity}; + +pub use cosmic_panel_config; + +const APPLET_PADDING: u32 = 8; + +#[must_use] +pub fn applet_button_theme() -> Button { + Button::Custom { + active: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, + ..t.active(&Button::Text) + }), + hover: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, + ..t.hovered(&Button::Text) + }), + } +} + +#[derive(Debug, Clone)] +pub struct CosmicAppletHelper { + pub size: Size, + pub anchor: PanelAnchor, + pub background: CosmicPanelBackground, + pub output_name: String, +} + +#[derive(Clone, Debug)] +pub enum Size { + PanelSize(PanelSize), + // (width, height) + Hardcoded((u16, u16)), +} + +impl Default for CosmicAppletHelper { + fn default() -> Self { + Self { + size: Size::PanelSize( + std::env::var("COSMIC_PANEL_SIZE") + .ok() + .and_then(|size| ron::from_str(size.as_str()).ok()) + .unwrap_or(PanelSize::S), + ), + anchor: std::env::var("COSMIC_PANEL_ANCHOR") + .ok() + .and_then(|size| ron::from_str(size.as_str()).ok()) + .unwrap_or(PanelAnchor::Top), + background: std::env::var("COSMIC_PANEL_BACKGROUND") + .ok() + .and_then(|size| ron::from_str(size.as_str()).ok()) + .unwrap_or(CosmicPanelBackground::ThemeDefault), + output_name: std::env::var("COSMIC_PANEL_OUTPUT").unwrap_or_default(), + } + } +} + +impl CosmicAppletHelper { + #[must_use] + pub fn suggested_size(&self) -> (u16, u16) { + match &self.size { + Size::PanelSize(size) => match size { + PanelSize::XL => (64, 64), + PanelSize::L => (36, 36), + PanelSize::M => (24, 24), + PanelSize::S => (16, 16), + PanelSize::XS => (12, 12), + }, + Size::Hardcoded((width, height)) => (*width, *height), + } + } + + // Set the default window size. Helper for application init with hardcoded size. + pub fn window_size(&mut self, width: u16, height: u16) { + self.size = Size::Hardcoded((width, height)); + } + + #[must_use] + pub fn window_settings(&self) -> Settings { + self.window_settings_with_flags(F::default()) + } + + #[must_use] + #[allow(clippy::cast_precision_loss)] + pub fn window_settings_with_flags(&self, flags: F) -> Settings { + let (width, height) = self.suggested_size(); + let width = u32::from(width); + let height = u32::from(height); + Settings { + initial_surface: InitialSurface::XdgWindow(SctkWindowSettings { + size: (width + APPLET_PADDING * 2, height + APPLET_PADDING * 2), + size_limits: Limits::NONE + .min_height(height as f32 + APPLET_PADDING as f32 * 2.0) + .max_height(height as f32 + APPLET_PADDING as f32 * 2.0) + .min_width(width as f32 + APPLET_PADDING as f32 * 2.0) + .max_width(width as f32 + APPLET_PADDING as f32 * 2.0), + resizable: None, + ..Default::default() + }), + ..cosmic::settings_with_flags(flags) + } + } + + #[must_use] + pub fn icon_button<'a, Message: 'static>( + &self, + icon_name: &'a str, + ) -> widget::Button<'a, Message, Renderer> { + cosmic::widget::button(cosmic::theme::Button::Text) + .icon( + cosmic::theme::Svg::Symbolic, + icon_name, + self.suggested_size().0, + ) + .padding(8) + } + + // TODO popup container which tracks the size of itself and requests the popup to resize to match + pub fn popup_container<'a, Message: 'static>( + &self, + content: impl Into>, + ) -> Container<'a, Message, Renderer> { + let (vertical_align, horizontal_align) = match self.anchor { + PanelAnchor::Left => (Vertical::Center, Horizontal::Left), + PanelAnchor::Right => (Vertical::Center, Horizontal::Right), + PanelAnchor::Top => (Vertical::Top, Horizontal::Center), + PanelAnchor::Bottom => (Vertical::Bottom, Horizontal::Center), + }; + + Container::::new(Container::::new(content).style( + cosmic::theme::Container::custom(|theme| Appearance { + text_color: Some(theme.cosmic().background.on.into()), + background: Some(Color::from(theme.cosmic().background.base).into()), + border_radius: 12.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + }), + )) + .width(Length::Shrink) + .height(Length::Shrink) + .align_x(horizontal_align) + .align_y(vertical_align) + } + + #[must_use] + #[allow(clippy::cast_possible_wrap)] + pub fn get_popup_settings( + &self, + parent: window::Id, + id: window::Id, + size: Option<(u32, u32)>, + width_padding: Option, + height_padding: Option, + ) -> SctkPopupSettings { + let (width, height) = self.suggested_size(); + let pixel_offset = 8; + let (offset, anchor, gravity) = match self.anchor { + PanelAnchor::Left => ((pixel_offset, 0), Anchor::Right, Gravity::Right), + PanelAnchor::Right => ((-pixel_offset, 0), Anchor::Left, Gravity::Left), + PanelAnchor::Top => ((0, pixel_offset), Anchor::Bottom, Gravity::Bottom), + PanelAnchor::Bottom => ((0, -pixel_offset), Anchor::Top, Gravity::Top), + }; + SctkPopupSettings { + parent, + id, + positioner: SctkPositioner { + anchor, + gravity, + offset, + size, + anchor_rect: Rectangle { + x: 0, + y: 0, + width: width_padding.unwrap_or(APPLET_PADDING as i32) * 2 + i32::from(width), + height: height_padding.unwrap_or(APPLET_PADDING as i32) * 2 + i32::from(height), + }, + reactive: true, + constraint_adjustment: 15, // slide_y, slide_x, flip_x, flip_y + ..Default::default() + }, + parent_size: None, + grab: true, + } + } +} diff --git a/cosmic-app-list/Cargo.toml b/cosmic-app-list/Cargo.toml index e37c0090..d78d4f02 100644 --- a/cosmic-app-list/Cargo.toml +++ b/cosmic-app-list/Cargo.toml @@ -5,16 +5,17 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit" } -cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] } -# libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "applet", "tokio"] } +cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "f0cfe09" } +cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"], rev = "f0cfe09" } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +cosmic-applet = { path = "../applet" } +# libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio"] } ron = "0.8" futures = "0.3" futures-util = "0.3" once_cell = "1.9" xdg = "2.4" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" calloop = "0.10" nix = "0.26" shlex = "1.1.0" @@ -29,3 +30,5 @@ i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester i18n-embed-fl = "0.6" rust-embed = "6.3" url = "2.3.1" +rust-embed-utils = "7.5.0" +rand = "0.8.5" diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index a6e7e63f..6bbfe294 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -1,10 +1,6 @@ -use std::collections::HashMap; -use std::path::Path; -use std::path::PathBuf; -use std::str::FromStr; - use crate::config; use crate::config::AppListConfig; +use crate::config::APP_ID; use crate::fl; use crate::toplevel_subscription::toplevel_subscription; use crate::toplevel_subscription::ToplevelRequest; @@ -13,46 +9,56 @@ use calloop::channel::Sender; use cctk::toplevel_info::ToplevelInfo; use cctk::wayland_client::protocol::wl_data_device_manager::DndAction; use cctk::wayland_client::protocol::wl_seat::WlSeat; -use cosmic::applet::cosmic_panel_config::PanelAnchor; -use cosmic::applet::CosmicAppletHelper; +use cosmic::cosmic_config; +use cosmic::cosmic_config::Config; use cosmic::iced; +use cosmic::iced::subscription::events_with; use cosmic::iced::wayland::actions::data_device::DataFromMimeType; use cosmic::iced::wayland::actions::data_device::DndIcon; use cosmic::iced::wayland::actions::window::SctkWindowSettings; use cosmic::iced::wayland::popup::destroy_popup; use cosmic::iced::wayland::popup::get_popup; -use cosmic::iced::widget::{column, dnd_source, mouse_listener, row, text, Column, Row}; +use cosmic::iced::widget::dnd_listener; +use cosmic::iced::widget::vertical_rule; +use cosmic::iced::widget::vertical_space; +use cosmic::iced::widget::{column, dnd_source, mouse_area, row, Column, Row}; +use cosmic::iced::Color; +use cosmic::iced::Limits; use cosmic::iced::Settings; use cosmic::iced::{window, Application, Command, Subscription}; -use cosmic::iced_native as native; -use cosmic::iced_native::alignment::Horizontal; -use cosmic::iced_native::subscription::events_with; -use cosmic::iced_native::widget::vertical_space; +use cosmic::iced_runtime::core::alignment::Horizontal; +use cosmic::iced_runtime::core::event; use cosmic::iced_sctk::commands::data_device::accept_mime_type; use cosmic::iced_sctk::commands::data_device::finish_dnd; use cosmic::iced_sctk::commands::data_device::request_dnd_data; use cosmic::iced_sctk::commands::data_device::set_actions; use cosmic::iced_sctk::commands::data_device::start_drag; -use cosmic::iced_sctk::layout::Limits; use cosmic::iced_sctk::settings::InitialSurface; -use cosmic::iced_sctk::widget::dnd_listener; -use cosmic::iced_sctk::widget::vertical_rule; use cosmic::iced_style::application::{self, Appearance}; -use cosmic::iced_style::Color; use cosmic::theme::Button; use cosmic::widget::divider; use cosmic::widget::rectangle_tracker::rectangle_tracker_subscription; use cosmic::widget::rectangle_tracker::RectangleTracker; use cosmic::widget::rectangle_tracker::RectangleUpdate; use cosmic::{Element, Theme}; +use cosmic_applet::cosmic_panel_config::PanelAnchor; +use cosmic_applet::CosmicAppletHelper; use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1; use freedesktop_desktop_entry::DesktopEntry; +use futures::future::pending; use iced::widget::container; use iced::Alignment; use iced::Background; use iced::Length; use itertools::Itertools; -use native::event; +use rand::{thread_rng, Rng}; +use std::borrow::Cow; +use std::collections::HashMap; +use std::path::Path; +use std::path::PathBuf; +use std::str::FromStr; +use std::time::Duration; +use tokio::time::sleep; use url::Url; static MIME_TYPE: &str = "text/uri-list"; @@ -71,15 +77,12 @@ pub fn run() -> cosmic::iced::Result { CosmicAppList::run(Settings { initial_surface: InitialSurface::XdgWindow(SctkWindowSettings { - iced_settings: cosmic::iced_native::window::Settings { - ..Default::default() - }, autosize: true, size_limits: Limits::NONE - .min_height(1) - .min_width(1) - .max_height(h) - .max_width(w), + .min_height(1.0) + .min_width(1.0) + .max_height(h as f32) + .max_width(w as f32), ..Default::default() }), ..Default::default() @@ -144,19 +147,19 @@ impl DockItem { let dots = (0..toplevels.len()) .into_iter() .map(|_| { - container(vertical_space(Length::Units(0))) + container(vertical_space(Length::Fixed(0.0))) .padding(dot_radius) - .style(<::Theme as container::StyleSheet>::Style::Custom( + .style(<::Theme as container::StyleSheet>::Style::Custom(Box::new( |theme| container::Appearance { text_color: Some(Color::TRANSPARENT), background: Some(Background::Color( theme.cosmic().on_bg_color().into(), )), - border_radius: 4.0, + border_radius: 4.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, }, - )) + ))) .into() }) .collect_vec(); @@ -179,12 +182,12 @@ impl DockItem { .into(), }; - let mut icon_button = cosmic::widget::button(Button::Text) + let icon_button = cosmic::widget::button(Button::Text) .custom(vec![icon_wrapper]) .padding(8); let icon_button = if interaction_enabled { dnd_source( - mouse_listener( + mouse_area( icon_button .on_press( toplevels @@ -222,7 +225,7 @@ struct DndOffer { struct CosmicAppList { theme: Theme, popup: Option<(window::Id, DockItem)>, - surface_id_ctr: u32, + surface_id_ctr: u128, subscription_ctr: u32, item_ctr: u32, active_list: Vec, @@ -262,6 +265,8 @@ enum Message { DndData(PathBuf), StartListeningForDnd, StopListeningForDnd, + IncrementSubscriptionCtr, + ConfigUpdated(AppListConfig), } #[derive(Debug, Clone, Default)] @@ -363,22 +368,20 @@ impl Application for CosmicAppList { fn new(_flags: ()) -> (Self, Command) { let config = config::AppListConfig::load().unwrap_or_default(); - let mut favorite_ctr = 0; - let self_ = CosmicAppList { + let mut self_ = CosmicAppList { favorite_list: desktop_info_for_app_ids(config.favorites.clone()) .into_iter() - .map(|e| { - favorite_ctr += 1; - DockItem { - id: favorite_ctr, - toplevels: Default::default(), - desktop_info: e, - } + .enumerate() + .map(|(favorite_ctr, e)| DockItem { + id: favorite_ctr as u32, + toplevels: Default::default(), + desktop_info: e, }) .collect(), config, ..Default::default() }; + self_.item_ctr = self_.favorite_list.len() as u32; (self_, Command::none()) } @@ -405,11 +408,11 @@ impl Application for CosmicAppList { }; self.surface_id_ctr += 1; - let new_id = window::Id::new(self.surface_id_ctr); + let new_id = window::Id(self.surface_id_ctr); self.popup = Some((new_id, toplevel_group.clone())); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -440,13 +443,16 @@ impl Application for CosmicAppList { self.favorite_list.push(entry); } - let _ = self.config.add_favorite(id); + self.config + .add_favorite(id, &Config::new(APP_ID, 1).unwrap()); if let Some((popup_id, _toplevel)) = self.popup.take() { return destroy_popup(popup_id); } } Message::UnFavorite(id) => { - let _ = self.config.remove_favorite(id.clone()); + let _ = self + .config + .remove_favorite(id.clone(), &Config::new(APP_ID, 1).unwrap()); if let Some(i) = self .favorite_list .iter() @@ -506,7 +512,10 @@ impl Application for CosmicAppList { .position(|t| t.desktop_info.id == id) { let t = self.favorite_list.remove(pos); - let _ = self.config.remove_favorite(t.desktop_info.id.clone()); + let _ = self.config.remove_favorite( + t.desktop_info.id.clone(), + &Config::new(APP_ID, 1).unwrap(), + ); Some((true, t)) } else { None @@ -514,7 +523,7 @@ impl Application for CosmicAppList { }) { self.surface_id_ctr += 1; - let icon_id = window::Id::new(self.surface_id_ctr); + let icon_id = window::Id(self.surface_id_ctr); self.dnd_source = Some((icon_id, toplevel_group.clone(), DndAction::empty())); return start_drag( vec![MIME_TYPE.to_string()], @@ -523,7 +532,7 @@ impl Application for CosmicAppList { } else { DndAction::Copy }, - window::Id::new(0), + window::Id(0), Some(DndIcon::Custom(icon_id)), Box::new(toplevel_group.clone()), ); @@ -629,7 +638,10 @@ impl Application for CosmicAppList { .and_then(|o| o.dock_item.map(|i| (i, o.preview_index))) { self.item_ctr += 1; - let _ = self.config.add_favorite(dock_item.desktop_info.id.clone()); + let _ = self.config.add_favorite( + dock_item.desktop_info.id.clone(), + &Config::new(APP_ID, 1).unwrap(), + ); if let Some((pos, is_favorite)) = self .active_list .iter() @@ -689,11 +701,26 @@ impl Application for CosmicAppList { self.toplevel_sender.replace(tx); } ToplevelUpdate::Finished => { - self.subscription_ctr += 1; for t in &mut self.favorite_list { t.toplevels.clear(); } self.active_list.clear(); + let subscription_ctr = self.subscription_ctr; + let mut rng = thread_rng(); + let rand_d = rng.gen_range(0..100); + return Command::perform( + async move { + if let Some(millis) = 2u64 + .checked_pow(subscription_ctr) + .and_then(|d| d.checked_add(rand_d)) + { + sleep(Duration::from_millis(millis)).await; + } else { + pending::<()>().await; + } + }, + |_| Message::IncrementSubscriptionCtr, + ); } ToplevelUpdate::RemoveToplevel(handle) => { for t in self @@ -765,6 +792,49 @@ impl Application for CosmicAppList { Message::StopListeningForDnd => { self.is_listening_for_dnd = false; } + Message::IncrementSubscriptionCtr => { + self.subscription_ctr += 1; + } + Message::ConfigUpdated(config) => { + self.config = config; + + let mut new_list: Vec<_> = desktop_info_for_app_ids(self.config.favorites.clone()) + .into_iter() + .map(|e| { + self.item_ctr += 1; + + DockItem { + id: self.item_ctr, + toplevels: Default::default(), + desktop_info: e, + } + }) + .collect(); + + for item in &mut new_list { + if let Some(old_item) = self + .favorite_list + .iter() + .position(|i| i.desktop_info.id == item.desktop_info.id) + { + let old_item = self.favorite_list.swap_remove(old_item); + *item = old_item; + } else if let Some(old_item) = self + .active_list + .iter() + .position(|i| i.desktop_info.id == item.desktop_info.id) + { + let old_item = self.active_list.remove(old_item); + *item = old_item; + } + } + + for item in self.favorite_list.drain(..) { + self.active_list.push(item); + } + + self.favorite_list = new_list; + } } Command::none() } @@ -970,7 +1040,7 @@ impl Application for CosmicAppList { ), }; if self.popup.is_some() { - mouse_listener(content) + mouse_area(content) .on_right_release(Message::ClosePopup) .on_press(Message::ClosePopup) .into() @@ -981,48 +1051,58 @@ impl Application for CosmicAppList { fn subscription(&self) -> Subscription { Subscription::batch(vec![ - toplevel_subscription(self.subscription_ctr).map(|(_, event)| Message::Toplevel(event)), + toplevel_subscription(self.subscription_ctr).map(|e| Message::Toplevel(e.1)), events_with(|e, _| match e { - native::Event::PlatformSpecific(event::PlatformSpecific::Wayland( - event::wayland::Event::Seat(e, seat), - )) => match e { + cosmic::iced_runtime::core::Event::PlatformSpecific( + event::PlatformSpecific::Wayland(event::wayland::Event::Seat(e, seat)), + ) => match e { event::wayland::SeatEvent::Enter => Some(Message::NewSeat(seat)), event::wayland::SeatEvent::Leave => Some(Message::RemovedSeat(seat)), }, // XXX Must be done to catch a finished drag after the source is removed // (for now, the source is removed when the drag starts) - native::Event::PlatformSpecific(event::PlatformSpecific::Wayland( - event::wayland::Event::DataSource( + cosmic::iced_runtime::core::Event::PlatformSpecific( + event::PlatformSpecific::Wayland(event::wayland::Event::DataSource( event::wayland::DataSourceEvent::DndFinished | event::wayland::DataSourceEvent::Cancelled, - ), - )) => Some(Message::DragFinished), - native::Event::PlatformSpecific(event::PlatformSpecific::Wayland( - event::wayland::Event::DndOffer(event::wayland::DndOfferEvent::Enter { - mime_types, - .. - }), - )) => { + )), + ) => Some(Message::DragFinished), + cosmic::iced_runtime::core::Event::PlatformSpecific( + event::PlatformSpecific::Wayland(event::wayland::Event::DndOffer( + event::wayland::DndOfferEvent::Enter { mime_types, .. }, + )), + ) => { if mime_types.iter().any(|m| m == MIME_TYPE) { Some(Message::StartListeningForDnd) } else { None } } - native::Event::PlatformSpecific(event::PlatformSpecific::Wayland( - event::wayland::Event::DndOffer( + cosmic::iced_runtime::core::Event::PlatformSpecific( + event::PlatformSpecific::Wayland(event::wayland::Event::DndOffer( event::wayland::DndOfferEvent::Leave | event::wayland::DndOfferEvent::DropPerformed, - ), - )) => Some(Message::StopListeningForDnd), + )), + ) => Some(Message::StopListeningForDnd), _ => None, }), - rectangle_tracker_subscription(0).map(|(_, update)| Message::Rectangle(update)), + rectangle_tracker_subscription(0).map(|update| Message::Rectangle(update.1)), + cosmic_config::config_subscription(0, Cow::from(APP_ID), 1).map(|(_, config)| { + match config { + Ok(config) => Message::ConfigUpdated(config), + Err((errors, config)) => { + for error in errors { + log::error!("{:?}", error); + } + Message::ConfigUpdated(config) + } + } + }), ]) } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -1030,9 +1110,9 @@ impl Application for CosmicAppList { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } } diff --git a/cosmic-app-list/src/config.rs b/cosmic-app-list/src/config.rs index 1a35b98d..dc6f5e70 100644 --- a/cosmic-app-list/src/config.rs +++ b/cosmic-app-list/src/config.rs @@ -1,21 +1,23 @@ use anyhow::anyhow; + +use cosmic::cosmic_config::cosmic_config_derive::CosmicConfigEntry; +use cosmic::cosmic_config::{self, Config, ConfigGet, ConfigSet, CosmicConfigEntry}; use serde::{Deserialize, Serialize}; use std::fmt::Debug; use std::fs::File; use std::path::PathBuf; use xdg::BaseDirectories; - pub const APP_ID: &str = "com.system76.CosmicAppList"; pub const VERSION: &str = "0.1.0"; -#[derive(Debug, Clone, Deserialize, Serialize, Default)] +#[derive(Debug, Clone, Deserialize, Serialize, Default, PartialEq, Eq)] pub enum TopLevelFilter { #[default] ActiveWorkspace, ConfiguredOutput, } -#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, Eq, CosmicConfigEntry)] pub struct AppListConfig { pub filter_top_levels: Option, pub favorites: Vec, @@ -42,26 +44,17 @@ impl AppListConfig { .map_err(|err| anyhow!("Failed to parse config file: {}", err)) } - pub fn add_favorite(&mut self, id: String) -> anyhow::Result<()> { + pub fn add_favorite(&mut self, id: String, config: &Config) { if !self.favorites.contains(&id) { self.favorites.push(id); + let _ = self.write_entry(&config); } - self.save() } - pub fn remove_favorite(&mut self, id: String) -> anyhow::Result<()> { - self.favorites.retain(|e| e != &id); - self.save() - } - - // TODO async? - pub fn save(&self) -> anyhow::Result<()> { - let bd = BaseDirectories::new()?; - let mut relative_path = PathBuf::from(APP_ID); - relative_path.push("config.ron"); - let config_path = bd.place_config_file(relative_path)?; - let f = File::create(config_path)?; - ron::ser::to_writer_pretty(f, self, Default::default())?; - Ok(()) + pub fn remove_favorite(&mut self, id: String, config: &Config) { + if let Some(pos) = self.favorites.iter().position(|e| e == &id) { + self.favorites.remove(pos); + let _ = self.write_entry(&config); + } } } diff --git a/cosmic-app-list/src/toplevel_subscription.rs b/cosmic-app-list/src/toplevel_subscription.rs index 0e017daf..6aa7d316 100644 --- a/cosmic-app-list/src/toplevel_subscription.rs +++ b/cosmic-app-list/src/toplevel_subscription.rs @@ -11,7 +11,7 @@ use futures::{ channel::mpsc::{unbounded, UnboundedReceiver}, StreamExt, }; -use std::{fmt::Debug, hash::Hash}; +use std::{fmt::Debug, hash::Hash, thread::JoinHandle}; use crate::toplevel_handler::toplevel_handler; @@ -26,31 +26,45 @@ pub enum State { Waiting( UnboundedReceiver, calloop::channel::Sender, + JoinHandle<()>, ), Finished, } -async fn start_listening(id: I, state: State) -> (Option<(I, ToplevelUpdate)>, State) { - match state { - State::Ready => { - let (calloop_tx, calloop_rx) = calloop::channel::channel(); - let (toplevel_tx, toplevel_rx) = unbounded(); - std::thread::spawn(move || { - toplevel_handler(toplevel_tx, calloop_rx); - }); - ( - Some((id, ToplevelUpdate::Init(calloop_tx.clone()))), - State::Waiting(toplevel_rx, calloop_tx), - ) - } - State::Waiting(mut rx, tx) => match rx.next().await { - Some(u) => (Some((id, u)), State::Waiting(rx, tx)), - None => { - let _ = tx.send(ToplevelRequest::Exit); - (Some((id, ToplevelUpdate::Finished)), State::Finished) +async fn start_listening(id: I, mut state: State) -> ((I, ToplevelUpdate), State) { + loop { + let (update, new_state) = match state { + State::Ready => { + let (calloop_tx, calloop_rx) = calloop::channel::channel(); + let (toplevel_tx, toplevel_rx) = unbounded(); + let handle = std::thread::spawn(move || { + toplevel_handler(toplevel_tx, calloop_rx); + }); + ( + Some((id, ToplevelUpdate::Init(calloop_tx.clone()))), + State::Waiting(toplevel_rx, calloop_tx, handle), + ) } - }, - State::Finished => iced::futures::future::pending().await, + State::Waiting(mut rx, tx, handle) => { + if handle.is_finished() { + return ((id, ToplevelUpdate::Finished), State::Finished); + } + match rx.next().await { + Some(u) => (Some((id, u)), State::Waiting(rx, tx, handle)), + None => { + let _ = tx.send(ToplevelRequest::Exit); + (Some((id, ToplevelUpdate::Finished)), State::Finished) + } + } + } + State::Finished => iced::futures::future::pending().await, + }; + + if let Some(update) = update { + return (update, new_state); + } else { + state = new_state; + } } } diff --git a/cosmic-applet-audio/Cargo.toml b/cosmic-applet-audio/Cargo.toml index 84f35d25..bb03ccfb 100644 --- a/cosmic-applet-audio/Cargo.toml +++ b/cosmic-applet-audio/Cargo.toml @@ -10,6 +10,14 @@ icon-loader = { version = "0.3.6", features = ["gtk"] } libpulse-binding = "2.26.0" libpulse-glib-binding = "2.25.0" tokio = { version = "1.20.1", features=["full"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } log = "0.4.14" pretty_env_logger = "0.4.0" +# Application i18n +i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester"] } +i18n-embed-fl = "0.6" +rust-embed = "6.6" +rust-embed-utils = "7.5.0" +once_cell = "1.17.1" + diff --git a/cosmic-applet-audio/i18n.toml b/cosmic-applet-audio/i18n.toml new file mode 100644 index 00000000..05c50ba2 --- /dev/null +++ b/cosmic-applet-audio/i18n.toml @@ -0,0 +1,4 @@ +fallback_language = "en" + +[fluent] +assets_dir = "i18n" \ No newline at end of file diff --git a/cosmic-applet-audio/i18n/en/cosmic_applet_audio.ftl b/cosmic-applet-audio/i18n/en/cosmic_applet_audio.ftl new file mode 100644 index 00000000..0fd4bbbd --- /dev/null +++ b/cosmic-applet-audio/i18n/en/cosmic_applet_audio.ftl @@ -0,0 +1,6 @@ +output = Output +input = Input +show-media-controls = Show Media Controls on Top Panel +sound-settings = Sound Settings... +disconnected = PulseAudio Disconnected +no-device = No device selected diff --git a/cosmic-applet-audio/src/localize.rs b/cosmic-applet-audio/src/localize.rs new file mode 100644 index 00000000..baa05d0d --- /dev/null +++ b/cosmic-applet-audio/src/localize.rs @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MPL-2.0-only + +use i18n_embed::{ + fluent::{fluent_language_loader, FluentLanguageLoader}, + DefaultLocalizer, LanguageLoader, Localizer, +}; +use once_cell::sync::Lazy; +use rust_embed::RustEmbed; + +#[derive(RustEmbed)] +#[folder = "i18n/"] +struct Localizations; + +pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { + let loader: FluentLanguageLoader = fluent_language_loader!(); + + loader + .load_fallback_language(&Localizations) + .expect("Error while loading fallback language"); + + loader +}); + +#[macro_export] +macro_rules! fl { + ($message_id:literal) => {{ + i18n_embed_fl::fl!($crate::localize::LANGUAGE_LOADER, $message_id) + }}; + + ($message_id:literal, $($args:expr),*) => {{ + i18n_embed_fl::fl!($crate::localize::LANGUAGE_LOADER, $message_id, $($args), *) + }}; +} + +// Get the `Localizer` to be used for localizing this library. +pub fn localizer() -> Box { + Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations)) +} + +pub fn localize() { + let localizer = localizer(); + let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages(); + + if let Err(error) = localizer.select(&requested_languages) { + eprintln!("Error while loading language for App List {}", error); + } +} diff --git a/cosmic-applet-audio/src/main.rs b/cosmic-applet-audio/src/main.rs index 5df43572..a40aabd2 100644 --- a/cosmic-applet-audio/src/main.rs +++ b/cosmic-applet-audio/src/main.rs @@ -1,11 +1,13 @@ +mod localize; + use cosmic::iced::widget; -use cosmic::iced_native::alignment::Horizontal; -use cosmic::iced_native::layout::Limits; +use cosmic::iced::Limits; +use cosmic::iced_runtime::core::alignment::Horizontal; use cosmic::theme::Svg; -use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME}; use cosmic::widget::{button, divider, icon}; use cosmic::Renderer; +use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; use cosmic::iced::{ self, @@ -20,12 +22,16 @@ use iced::widget::container; use iced::Color; mod pulse; +use crate::localize::localize; use crate::pulse::DeviceInfo; use libpulse_binding::volume::VolumeLinear; pub fn main() -> cosmic::iced::Result { pretty_env_logger::init(); + // Prepare i18n + localize(); + let helper = CosmicAppletHelper::default(); Audio::run(helper.window_settings()) } @@ -43,7 +49,7 @@ struct Audio { theme: Theme, popup: Option, show_media_controls_in_top_panel: bool, - id_ctr: u32, + id_ctr: u128, } #[derive(Debug, PartialEq, Eq)] @@ -93,7 +99,7 @@ impl Application for Audio { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -101,10 +107,10 @@ impl Application for Audio { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } fn update(&mut self, message: Message) -> Command { @@ -117,21 +123,21 @@ impl Application for Audio { conn.send(pulse::Message::UpdateConnection); } self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, None, ); popup_settings.positioner.size_limits = Limits::NONE - .min_height(1) - .min_width(1) - .max_width(400) - .max_height(1080); + .min_height(1.0) + .min_width(1.0) + .max_width(400.0) + .max_height(1080.0); if let Some(conn) = self.pulse_state.connection() { conn.send(pulse::Message::GetDefaultSink); @@ -268,7 +274,7 @@ impl Application for Audio { } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { + if id == window::Id(0) { self.applet_helper .icon_button(&self.icon_name) .on_press(Message::TogglePopup) @@ -291,20 +297,18 @@ impl Application for Audio { .0 * 100.0; let audio_content = if audio_disabled { - column![text("PulseAudio Disconnected") + column![text(fl!("disconnected")) .width(Length::Fill) .horizontal_alignment(Horizontal::Center) .size(24),] } else { column![ row![ - icon("audio-volume-high-symbolic", 32) - .width(Length::Units(24)) - .height(Length::Units(24)) - .style(Svg::Symbolic), + icon("audio-volume-high-symbolic", 24).style(Svg::Symbolic), slider(0.0..=100.0, out_f64, Message::SetOutputVolume) .width(Length::FillPortion(5)), text(format!("{}%", out_f64.round())) + .size(16) .width(Length::FillPortion(1)) .horizontal_alignment(Horizontal::Right) ] @@ -312,13 +316,11 @@ impl Application for Audio { .align_items(Alignment::Center) .padding([8, 24]), row![ - icon("audio-input-microphone-symbolic", 32) - .width(Length::Units(24)) - .height(Length::Units(24)) - .style(Svg::Symbolic), + icon("audio-input-microphone-symbolic", 24).style(Svg::Symbolic), slider(0.0..=100.0, in_f64, Message::SetInputVolume) .width(Length::FillPortion(5)), text(format!("{}%", in_f64.round())) + .size(16) .width(Length::FillPortion(1)) .horizontal_alignment(Horizontal::Right) ] @@ -330,7 +332,7 @@ impl Application for Audio { .width(Length::Fill), revealer( self.is_open == IsOpen::Output, - "Output", + fl!("output"), match &self.current_output { Some(output) => pretty_name(output.description.clone()), None => String::from("No device selected"), @@ -348,10 +350,10 @@ impl Application for Audio { ), revealer( self.is_open == IsOpen::Input, - "Input", + fl!("input"), match &self.current_input { Some(input) => pretty_name(input.description.clone()), - None => String::from("No device selected"), + None => fl!("no-device"), }, self.inputs .clone() @@ -372,17 +374,20 @@ impl Application for Audio { container(divider::horizontal::light()) .padding([12, 24]) .width(Length::Fill), - container(toggler( - Some("Show Media Controls on Top Panel".into()), - self.show_media_controls_in_top_panel, - Message::ToggleMediaControlsInTopPanel, - )) + container( + toggler( + Some(fl!("show-media-controls")), + self.show_media_controls_in_top_panel, + Message::ToggleMediaControlsInTopPanel, + ) + .text_size(14) + ) .padding([0, 24]), container(divider::horizontal::light()) .padding([12, 24]) .width(Length::Fill), - button(APPLET_BUTTON_THEME) - .text("Sound Settings...") + button(applet_button_theme()) + .custom(vec![text(fl!("sound-settings")).size(14).into()]) .padding([8, 24]) .width(Length::Fill) ] @@ -398,19 +403,19 @@ impl Application for Audio { fn revealer( open: bool, - title: &str, + title: String, selected: String, options: Vec<(String, String)>, toggle: Message, mut change: impl FnMut(String) -> Message + 'static, -) -> widget::Column { +) -> widget::Column<'static, Message, Renderer> { if open { options.iter().fold( column![revealer_head(open, title, selected, toggle)].width(Length::Fill), |col, (id, name)| { col.push( - button(APPLET_BUTTON_THEME) - .custom(vec![text(name).into()]) + button(applet_button_theme()) + .custom(vec![text(name).size(14).into()]) .on_press(change(id.clone())) .width(Length::Fill) .padding([8, 48]), @@ -424,14 +429,14 @@ fn revealer( fn revealer_head( _open: bool, - title: &str, + title: String, selected: String, toggle: Message, -) -> widget::Button { - button(APPLET_BUTTON_THEME) +) -> widget::Button<'static, Message, Renderer> { + button(applet_button_theme()) .custom(vec![ - text(title).width(Length::Fill).into(), - text(selected).into(), + text(title).width(Length::Fill).size(14).into(), + text(selected).size(10).into(), ]) .padding([8, 24]) .width(Length::Fill) diff --git a/cosmic-applet-audio/src/pulse.rs b/cosmic-applet-audio/src/pulse.rs index 37a427eb..a86a501e 100644 --- a/cosmic-applet-audio/src/pulse.rs +++ b/cosmic-applet-audio/src/pulse.rs @@ -1,8 +1,8 @@ -use cosmic::iced_native::subscription::{self, Subscription}; use std::cell::RefCell; use std::{rc::Rc, thread}; extern crate libpulse_binding as pulse; +use cosmic::iced::{subscription, Subscription}; //use futures::channel::mpsc; use libpulse_binding::{ callbacks::ListResult, @@ -15,71 +15,80 @@ use libpulse_binding::{ proplist::Proplist, volume::ChannelVolumes, }; + pub fn connect() -> Subscription { struct Connect; subscription::unfold( std::any::TypeId::of::(), State::Init, - |state| async move { - match state { - State::Init => { - let PulseHandle { - to_pulse, - from_pulse, - } = PulseHandle::new(); - ( - Some(Event::Init(Connection(to_pulse))), - State::Connecting(from_pulse), - ) - } - // Waiting for Connection to succeed - // The GUI doesn't have to monitor this state, as it is never sent to the GUI - State::Connecting(mut from_pulse) => match from_pulse.recv().await { - Some(Message::Connected) => { - (Some(Event::Connected), State::Connected(from_pulse)) - } - Some(Message::Disconnected) => { - (Some(Event::Disconnected), State::Connecting(from_pulse)) - } - Some(m) => { - panic!("Unexpected message: {:?}", m); - } - None => { - panic!("Pulse Sender dropped, something has gone wrong!"); - } - }, - State::Connected(mut from_pulse) => { - // This is where we match messages from the pulse server to pass to the gui - match from_pulse.recv().await { - Some(Message::SetSinks(sinks)) => ( - Some(Event::MessageReceived(Message::SetSinks(sinks))), - State::Connected(from_pulse), - ), - Some(Message::SetSources(sources)) => ( - Some(Event::MessageReceived(Message::SetSources(sources))), - State::Connected(from_pulse), - ), - Some(Message::SetDefaultSink(sink)) => ( - Some(Event::MessageReceived(Message::SetDefaultSink(sink))), - State::Connected(from_pulse), - ), - Some(Message::SetDefaultSource(source)) => ( - Some(Event::MessageReceived(Message::SetDefaultSource(source))), - State::Connected(from_pulse), - ), - Some(Message::Disconnected) => { - (Some(Event::Disconnected), State::Connecting(from_pulse)) - } - None => (Some(Event::Disconnected), State::Connecting(from_pulse)), - _ => (None, State::Connected(from_pulse)), - } + |mut state| async move { + loop { + let (update, new_state) = connection(state).await; + state = new_state; + if let Some(update) = update { + return (update, state); } } }, ) } +async fn connection(state: State) -> (Option, State) { + match state { + State::Init => { + let PulseHandle { + to_pulse, + from_pulse, + } = PulseHandle::new(); + ( + Some(Event::Init(Connection(to_pulse))), + State::Connecting(from_pulse), + ) + } + // Waiting for Connection to succeed + // The GUI doesn't have to monitor this state, as it is never sent to the GUI + State::Connecting(mut from_pulse) => match from_pulse.recv().await { + Some(Message::Connected) => (Some(Event::Connected), State::Connected(from_pulse)), + Some(Message::Disconnected) => { + (Some(Event::Disconnected), State::Connecting(from_pulse)) + } + Some(m) => { + panic!("Unexpected message: {:?}", m); + } + None => { + panic!("Pulse Sender dropped, something has gone wrong!"); + } + }, + State::Connected(mut from_pulse) => { + // This is where we match messages from the pulse server to pass to the gui + match from_pulse.recv().await { + Some(Message::SetSinks(sinks)) => ( + Some(Event::MessageReceived(Message::SetSinks(sinks))), + State::Connected(from_pulse), + ), + Some(Message::SetSources(sources)) => ( + Some(Event::MessageReceived(Message::SetSources(sources))), + State::Connected(from_pulse), + ), + Some(Message::SetDefaultSink(sink)) => ( + Some(Event::MessageReceived(Message::SetDefaultSink(sink))), + State::Connected(from_pulse), + ), + Some(Message::SetDefaultSource(source)) => ( + Some(Event::MessageReceived(Message::SetDefaultSource(source))), + State::Connected(from_pulse), + ), + Some(Message::Disconnected) => { + (Some(Event::Disconnected), State::Connecting(from_pulse)) + } + None => (Some(Event::Disconnected), State::Connecting(from_pulse)), + _ => (None, State::Connected(from_pulse)), + } + } + } +} + // #[derive(Debug)] enum State { Init, diff --git a/cosmic-applet-battery/Cargo.toml b/cosmic-applet-battery/Cargo.toml index 0b43d454..9de9b42d 100644 --- a/cosmic-applet-battery/Cargo.toml +++ b/cosmic-applet-battery/Cargo.toml @@ -5,11 +5,12 @@ edition = "2021" [dependencies] once_cell = "1.16.0" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } futures = "0.3" -zbus = { version = "3.5", default-features = false, features = ["tokio"] } +zbus = { version = "3.13", default-features = false, features = ["tokio"] } log = "0.4" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" # Application i18n i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.6.4" diff --git a/cosmic-applet-battery/src/app.rs b/cosmic-applet-battery/src/app.rs index 10870744..cdf905ab 100644 --- a/cosmic-applet-battery/src/app.rs +++ b/cosmic-applet-battery/src/app.rs @@ -10,19 +10,19 @@ use crate::upower_device::{device_subscription, DeviceDbusEvent}; use crate::upower_kbdbacklight::{ kbd_backlight_subscription, KeyboardBacklightRequest, KeyboardBacklightUpdate, }; -use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME}; use cosmic::iced::alignment::Horizontal; use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; +use cosmic::iced::Color; use cosmic::iced::{ widget::{column, container, row, slider, text}, window, Alignment, Application, Command, Length, Subscription, }; -use cosmic::iced_native::layout::Limits; +use cosmic::iced_runtime::core::layout::Limits; use cosmic::iced_style::application::{self, Appearance}; -use cosmic::iced_style::Color; use cosmic::theme::Svg; use cosmic::widget::{button, divider, icon, toggler}; use cosmic::{Element, Theme}; +use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; use log::error; use std::time::Duration; use tokio::sync::mpsc::UnboundedSender; @@ -58,7 +58,7 @@ struct CosmicBatteryApplet { kbd_brightness: f64, screen_brightness: f64, popup: Option, - id_ctr: u32, + id_ctr: u128, screen_sender: Option>, kbd_sender: Option>, applet_helper: CosmicAppletHelper, @@ -144,21 +144,21 @@ impl Application for CosmicBatteryApplet { } self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, None, ); popup_settings.positioner.size_limits = Limits::NONE - .max_width(372) - .min_width(300) - .min_height(200) - .max_height(1080); + .max_width(372.0) + .min_width(300.0) + .min_height(200.0) + .max_height(1080.0); if let Some(tx) = self.power_profile_sender.as_ref() { let _ = tx.send(PowerProfileRequest::Get); } @@ -213,13 +213,13 @@ impl Application for CosmicBatteryApplet { Command::none() } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { + if id == window::Id(0) { self.applet_helper .icon_button(&self.icon_name) .on_press(Message::TogglePopup) .into() } else { - let name = text(fl!("battery")).size(18); + let name = text(fl!("battery")).size(14); let description = text( if "battery-full-charging-symbolic" == self.icon_name || "battery-full-charged-symbolic" == self.icon_name @@ -234,15 +234,12 @@ impl Application for CosmicBatteryApplet { ) }, ) - .size(12); + .size(10); self.applet_helper .popup_container( column![ row![ - icon(&*self.icon_name, 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon(&*self.icon_name, 24).style(Svg::Symbolic), column![name, description] ] .padding([0, 24]) @@ -251,11 +248,11 @@ impl Application for CosmicBatteryApplet { container(divider::horizontal::light()) .width(Length::Fill) .padding([0, 12]), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(fl!("battery")).size(14), - text(fl!("battery-desc")).size(12) + text(fl!("battery-desc")).size(10) ] .width(Length::Fill), icon("emblem-ok-symbolic", 12).size(12).style( @@ -270,11 +267,11 @@ impl Application for CosmicBatteryApplet { .padding([8, 24]) .on_press(Message::SelectProfile(Power::Battery)) .width(Length::Fill), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(fl!("balanced")).size(14), - text(fl!("balanced-desc")).size(12) + text(fl!("balanced-desc")).size(10) ] .width(Length::Fill), icon("emblem-ok-symbolic", 12).size(12).style( @@ -289,11 +286,11 @@ impl Application for CosmicBatteryApplet { .padding([8, 24]) .on_press(Message::SelectProfile(Power::Balanced)) .width(Length::Fill), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(fl!("performance")).size(14), - text(fl!("performance-desc")).size(12) + text(fl!("performance-desc")).size(10) ] .width(Length::Fill), icon("emblem-ok-symbolic", 12).size(12).style( @@ -311,42 +308,42 @@ impl Application for CosmicBatteryApplet { container(divider::horizontal::light()) .width(Length::Fill) .padding([0, 12]), - container(toggler(fl!("max-charge"), self.charging_limit, |_| { - Message::SetChargingLimit(!self.charging_limit) - })) + container( + toggler(fl!("max-charge"), self.charging_limit, |_| { + Message::SetChargingLimit(!self.charging_limit) + }) + .text_size(14) + .width(Length::Fill) + ) .padding([0, 24]) .width(Length::Fill), container(divider::horizontal::light()) .width(Length::Fill) .padding([0, 12]), row![ - icon("display-brightness-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("display-brightness-symbolic", 24).style(Svg::Symbolic), slider( 1..=100, (self.screen_brightness * 100.0) as i32, Message::SetScreenBrightness ), text(format!("{:.0}%", self.screen_brightness * 100.0)) - .width(Length::Units(40)) + .size(16) + .width(Length::Fixed(40.0)) .horizontal_alignment(Horizontal::Right) ] .padding([0, 24]) .spacing(12), row![ - icon("keyboard-brightness-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("keyboard-brightness-symbolic", 24).style(Svg::Symbolic), slider( 0..=100, (self.kbd_brightness * 100.0) as i32, Message::SetKbdBrightness ), text(format!("{:.0}%", self.kbd_brightness * 100.0)) - .width(Length::Units(40)) + .size(16) + .width(Length::Fixed(40.0)) .horizontal_alignment(Horizontal::Right) ] .padding([0, 24]) @@ -354,8 +351,11 @@ impl Application for CosmicBatteryApplet { container(divider::horizontal::light()) .width(Length::Fill) .padding([0, 12]), - button(APPLET_BUTTON_THEME) - .custom(vec![text(fl!("power-settings")).width(Length::Fill).into()]) + button(applet_button_theme()) + .custom(vec![text(fl!("power-settings")) + .size(14) + .width(Length::Fill) + .into()]) .on_press(Message::OpenBatterySettings) .width(Length::Fill) .padding([8, 24]) @@ -369,35 +369,38 @@ impl Application for CosmicBatteryApplet { fn subscription(&self) -> Subscription { Subscription::batch(vec![ - device_subscription(0).map(|(_, event)| match event { - DeviceDbusEvent::Update { - icon_name, - percent, - time_to_empty, - } => Message::Update { + device_subscription(0).map( + |( + _, + DeviceDbusEvent::Update { + icon_name, + percent, + time_to_empty, + }, + )| Message::Update { icon_name, percent, time_to_empty, }, + ), + kbd_backlight_subscription(0).map(|event| match event { + (_, KeyboardBacklightUpdate::Update(b)) => Message::UpdateKbdBrightness(b), + (_, KeyboardBacklightUpdate::Init(tx, b)) => Message::InitKbdBacklight(tx, b), }), - kbd_backlight_subscription(0).map(|(_, event)| match event { - KeyboardBacklightUpdate::Update(b) => Message::UpdateKbdBrightness(b), - KeyboardBacklightUpdate::Init(tx, b) => Message::InitKbdBacklight(tx, b), + screen_backlight_subscription(0).map(|e| match e { + (_, ScreenBacklightUpdate::Update(b)) => Message::UpdateScreenBrightness(b), + (_, ScreenBacklightUpdate::Init(tx, b)) => Message::InitScreenBacklight(tx, b), }), - screen_backlight_subscription(0).map(|(_, event)| match event { - ScreenBacklightUpdate::Update(b) => Message::UpdateScreenBrightness(b), - ScreenBacklightUpdate::Init(tx, b) => Message::InitScreenBacklight(tx, b), - }), - power_profile_subscription(0).map(|(_, event)| match event { - PowerProfileUpdate::Update { profile } => Message::Profile(profile), - PowerProfileUpdate::Init(tx, p) => Message::InitProfile(p, tx), - PowerProfileUpdate::Error(e) => Message::Errored(e), // TODO: handle error + power_profile_subscription(0).map(|event| match event { + (_, PowerProfileUpdate::Update { profile }) => Message::Profile(profile), + (_, PowerProfileUpdate::Init(tx, p)) => Message::InitProfile(p, tx), + (_, PowerProfileUpdate::Error(e)) => Message::Errored(e), // TODO: handle error }), ]) } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Message { @@ -405,9 +408,9 @@ impl Application for CosmicBatteryApplet { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } } diff --git a/cosmic-applet-battery/src/backlight.rs b/cosmic-applet-battery/src/backlight.rs index aad39c06..64fe65d1 100644 --- a/cosmic-applet-battery/src/backlight.rs +++ b/cosmic-applet-battery/src/backlight.rs @@ -78,7 +78,20 @@ pub async fn backlight() -> io::Result> { pub fn screen_backlight_subscription( id: I, ) -> iced::Subscription<(I, ScreenBacklightUpdate)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| start_listening_loop(id, state)) +} + +async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, ScreenBacklightUpdate), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } } pub enum State { diff --git a/cosmic-applet-battery/src/power_daemon.rs b/cosmic-applet-battery/src/power_daemon.rs index cd804879..bfc7f950 100644 --- a/cosmic-applet-battery/src/power_daemon.rs +++ b/cosmic-applet-battery/src/power_daemon.rs @@ -19,7 +19,7 @@ //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. use cosmic::iced; -use cosmic::iced_native::subscription; +use cosmic::iced::subscription; use std::fmt::Debug; use std::hash::Hash; use tokio::sync::mpsc::UnboundedReceiver; @@ -114,7 +114,9 @@ pub async fn set_power_profile(daemon: PowerDaemonProxy<'_>, power: Power) -> Re pub fn power_profile_subscription( id: I, ) -> iced::Subscription<(I, PowerProfileUpdate)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| { + start_listening_loop(id, state) + }) } #[derive(Debug)] @@ -124,6 +126,19 @@ pub enum State { Finished, } +async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, PowerProfileUpdate), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } +} + async fn start_listening(id: I, state: State) -> (Option<(I, PowerProfileUpdate)>, State) { match state { State::Ready => { @@ -189,14 +204,11 @@ async fn start_listening(id: I, state: State) -> (Option<(I, PowerProfi } } Some(PowerProfileRequest::Set(profile)) => { - if set_power_profile(power_proxy, profile).await.is_ok() { - ( - Some((id, PowerProfileUpdate::Update { profile })), - State::Waiting(conn, rx), - ) - } else { - (None, State::Waiting(conn, rx)) - } + let _ = set_power_profile(power_proxy, profile).await; + ( + Some((id, PowerProfileUpdate::Update { profile })), + State::Waiting(conn, rx), + ) } None => (None, State::Finished), } diff --git a/cosmic-applet-battery/src/upower_device.rs b/cosmic-applet-battery/src/upower_device.rs index b1142789..0b721f44 100644 --- a/cosmic-applet-battery/src/upower_device.rs +++ b/cosmic-applet-battery/src/upower_device.rs @@ -153,7 +153,7 @@ trait Device { pub fn device_subscription( id: I, ) -> iced::Subscription<(I, DeviceDbusEvent)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| start_listening_loop(id, state)) } #[derive(Debug)] @@ -174,6 +174,19 @@ async fn display_device() -> zbus::Result> { .await } +async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, DeviceDbusEvent), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } +} + async fn start_listening(id: I, state: State) -> (Option<(I, DeviceDbusEvent)>, State) { match state { State::Ready => { diff --git a/cosmic-applet-battery/src/upower_kbdbacklight.rs b/cosmic-applet-battery/src/upower_kbdbacklight.rs index 133c3c1a..04088d33 100644 --- a/cosmic-applet-battery/src/upower_kbdbacklight.rs +++ b/cosmic-applet-battery/src/upower_kbdbacklight.rs @@ -8,6 +8,7 @@ use iced::subscription; use std::{fmt::Debug, hash::Hash}; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; use zbus::dbus_proxy; + #[dbus_proxy( default_service = "org.freedesktop.UPower", interface = "org.freedesktop.UPower.KbdBacklight", @@ -35,7 +36,20 @@ trait KbdBacklight { pub fn kbd_backlight_subscription( id: I, ) -> iced::Subscription<(I, KeyboardBacklightUpdate)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| start_listening_loop(id, state)) +} + +async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, KeyboardBacklightUpdate), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } } #[derive(Debug)] diff --git a/cosmic-applet-bluetooth/Cargo.toml b/cosmic-applet-bluetooth/Cargo.toml index b06dfc31..55701a53 100644 --- a/cosmic-applet-bluetooth/Cargo.toml +++ b/cosmic-applet-bluetooth/Cargo.toml @@ -8,10 +8,11 @@ license = "GPL-3.0-or-later" once_cell = "1.16.0" bluer = { version = "0.15", features = ["bluetoothd", "id"] } futures-util = "0.3.21" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +cosmic-applet = { path = "../applet" } futures = "0.3" log = "0.4" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" itertools = "0.10.3" slotmap = "1.0.6" tokio = { version = "1.15.0", features = ["full"] } diff --git a/cosmic-applet-bluetooth/src/app.rs b/cosmic-applet-bluetooth/src/app.rs index 4a3e0ec3..9438205e 100644 --- a/cosmic-applet-bluetooth/src/app.rs +++ b/cosmic-applet-bluetooth/src/app.rs @@ -1,19 +1,14 @@ use crate::bluetooth::{BluerDeviceStatus, BluerRequest, BluerState}; -use cosmic::applet::APPLET_BUTTON_THEME; use cosmic::iced_style; use cosmic::{ - applet::CosmicAppletHelper, iced::{ - wayland::{ - popup::{destroy_popup, get_popup}, - }, + wayland::popup::{destroy_popup, get_popup}, widget::{column, container, row, scrollable, text, Column}, Alignment, Application, Color, Command, Length, Subscription, }, - iced_native::{ + iced_runtime::core::{ alignment::{Horizontal, Vertical}, layout::Limits, - renderer::BorderRadius, window, }, iced_style::{application, button::StyleSheet}, @@ -21,6 +16,7 @@ use cosmic::{ widget::{button, divider, icon, toggler}, Element, Theme, }; +use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; use std::collections::HashMap; use std::time::Duration; use tokio::sync::mpsc::Sender; @@ -38,7 +34,7 @@ struct CosmicBluetoothApplet { icon_name: String, theme: Theme, popup: Option, - id_ctr: u32, + id_ctr: u128, applet_helper: CosmicAppletHelper, bluer_state: BluerState, bluer_sender: Option>, @@ -87,11 +83,11 @@ impl Application for CosmicBluetoothApplet { } else { // TODO request update of state maybe self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -99,10 +95,10 @@ impl Application for CosmicBluetoothApplet { ); popup_settings.positioner.size_limits = Limits::NONE - .min_height(1) - .min_width(1) - .max_height(800) - .max_width(400); + .min_height(1.0) + .min_width(1.0) + .max_height(800.0) + .max_width(400.0); let tx = self.bluer_sender.as_ref().cloned(); return Command::batch(vec![ Command::perform( @@ -275,17 +271,17 @@ impl Application for CosmicBluetoothApplet { Command::none() } fn view(&self, id: window::Id) -> Element { - let button_style = Button::Custom { - active: |t| iced_style::button::Appearance { - border_radius: BorderRadius::from(0.0), + let button_style = || Button::Custom { + active: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, ..t.active(&Button::Text) - }, - hover: |t| iced_style::button::Appearance { - border_radius: BorderRadius::from(0.0), + }), + hover: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, ..t.hovered(&Button::Text) - }, + }), }; - if id == window::Id::new(0) { + if id == window::Id(0) { self.applet_helper .icon_button(&self.icon_name) .on_press(Message::TogglePopup) @@ -320,20 +316,15 @@ impl Application for CosmicBluetoothApplet { } BluerDeviceStatus::Paired => {} BluerDeviceStatus::Connecting | BluerDeviceStatus::Disconnecting => { - row = row.push( - icon("process-working-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), - ); + row = row.push(icon("process-working-symbolic", 24).style(Svg::Symbolic)); } BluerDeviceStatus::Disconnected | BluerDeviceStatus::Pairing => continue, }; known_bluetooth = known_bluetooth.push( - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row.into()]) - .style(APPLET_BUTTON_THEME) + .style(applet_button_theme()) .on_press(match dev.status { BluerDeviceStatus::Connected => { Message::Request(BluerRequest::DisconnectDevice(dev.address)) @@ -392,25 +383,20 @@ impl Application for CosmicBluetoothApplet { text(fl!("other-devices")) .size(14) .width(Length::Fill) - .height(Length::Units(24)) + .height(Length::Fixed(24.0)) .vertical_alignment(Vertical::Center) .into(), - container( - icon(dropdown_icon, 14) - .style(Svg::Symbolic) - .width(Length::Units(14)) - .height(Length::Units(14)), - ) - .align_x(Horizontal::Center) - .align_y(Vertical::Center) - .width(Length::Units(24)) - .height(Length::Units(24)) - .into(), + container(icon(dropdown_icon, 14).style(Svg::Symbolic)) + .align_x(Horizontal::Center) + .align_y(Vertical::Center) + .width(Length::Fixed(24.0)) + .height(Length::Fixed(24.0)) + .into(), ] .into(), ) .padding([8, 24]) - .style(button_style.clone()) + .style(button_style()) .on_press(Message::ToggleVisibleDevices(!self.show_visible_devices)); content = content.push(available_connections_btn); let mut list_column: Vec> = @@ -420,6 +406,7 @@ impl Application for CosmicBluetoothApplet { let row = column![ icon(device.icon.as_str(), 16).style(Svg::Symbolic), text(&device.name) + .size(14) .horizontal_alignment(Horizontal::Left) .vertical_alignment(Vertical::Center) .width(Length::Fill), @@ -435,20 +422,20 @@ impl Application for CosmicBluetoothApplet { .horizontal_alignment(Horizontal::Center) .vertical_alignment(Vertical::Center) .width(Length::Fill) - .size(32), + .size(22), row![ button(Button::Secondary) .custom( vec![text(fl!("cancel")) .size(14) .width(Length::Fill) - .height(Length::Units(24)) + .height(Length::Fixed(24.0)) .vertical_alignment(Vertical::Center) .into(),] .into(), ) .padding([8, 24]) - .style(button_style.clone()) + .style(button_style()) .on_press(Message::Cancel) .width(Length::Fill), button(Button::Secondary) @@ -456,13 +443,13 @@ impl Application for CosmicBluetoothApplet { vec![text(fl!("confirm")) .size(14) .width(Length::Fill) - .height(Length::Units(24)) + .height(Length::Fixed(24.0)) .vertical_alignment(Vertical::Center) .into(),] .into(), ) .padding([8, 24]) - .style(button_style.clone()) + .style(button_style()) .on_press(Message::Confirm) .width(Length::Fill), ] @@ -494,7 +481,7 @@ impl Application for CosmicBluetoothApplet { .align_items(Alignment::Center) .spacing(12); visible_devices = visible_devices.push( - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row.width(Length::Fill).into()]) .on_press(Message::Request(BluerRequest::PairDevice( dev.address.clone(), @@ -516,7 +503,7 @@ impl Application for CosmicBluetoothApplet { if item_counter > 10 { content = content.push( - scrollable(Column::with_children(list_column)).height(Length::Units(300)), + scrollable(Column::with_children(list_column)).height(Length::Fixed(300.0)), ); } else { content = content.push(Column::with_children(list_column)); @@ -526,11 +513,11 @@ impl Application for CosmicBluetoothApplet { } fn subscription(&self) -> Subscription { - bluetooth_subscription(0).map(|e| Message::BluetoothEvent(e.1)) + bluetooth_subscription(0).map(|(_, e)| Message::BluetoothEvent(e)) } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -538,9 +525,11 @@ impl Application for CosmicBluetoothApplet { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| application::Appearance { - background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), - text_color: theme.cosmic().on_bg_color().into(), - }) + ::Style::Custom(Box::new(|theme| { + application::Appearance { + background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), + text_color: theme.cosmic().on_bg_color().into(), + } + })) } } diff --git a/cosmic-applet-bluetooth/src/bluetooth.rs b/cosmic-applet-bluetooth/src/bluetooth.rs index 5235d2c4..d363e72c 100644 --- a/cosmic-applet-bluetooth/src/bluetooth.rs +++ b/cosmic-applet-bluetooth/src/bluetooth.rs @@ -21,7 +21,7 @@ use tokio::{ pub fn bluetooth_subscription( id: I, ) -> iced::Subscription<(I, BluerEvent)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| start_listening_loop(id, state)) } pub enum State { @@ -30,6 +30,19 @@ pub enum State { Finished, } +async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, BluerEvent), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } +} + async fn start_listening(id: I, state: State) -> (Option<(I, BluerEvent)>, State) { match state { State::Ready => { diff --git a/cosmic-applet-graphics/Cargo.toml b/cosmic-applet-graphics/Cargo.toml index 9cbc385e..7b35533b 100644 --- a/cosmic-applet-graphics/Cargo.toml +++ b/cosmic-applet-graphics/Cargo.toml @@ -6,8 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zbus = "3.4" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +zbus = "3.13" +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } once_cell = "1" # Application i18n i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] } diff --git a/cosmic-applet-graphics/src/main.rs b/cosmic-applet-graphics/src/main.rs index 74e62534..af594829 100644 --- a/cosmic-applet-graphics/src/main.rs +++ b/cosmic-applet-graphics/src/main.rs @@ -4,10 +4,10 @@ mod localize; mod window; use cosmic::{ - applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper}, iced::{wayland::InitialSurface, Application, Settings}, - iced_native::layout::Limits, + iced_runtime::core::layout::Limits, }; +use cosmic_applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper}; use window::*; @@ -21,10 +21,10 @@ pub fn main() -> cosmic::iced::Result { InitialSurface::XdgWindow(w) => { w.autosize = true; w.size_limits = Limits::NONE - .min_height(1) - .max_height(200) - .min_width(1) - .max_width(1000); + .min_height(1.0) + .max_height(200.0) + .min_width(1.0) + .max_width(1000.0); } InitialSurface::None => unimplemented!(), }; diff --git a/cosmic-applet-graphics/src/window.rs b/cosmic-applet-graphics/src/window.rs index 3ff43c14..4f4687ee 100644 --- a/cosmic-applet-graphics/src/window.rs +++ b/cosmic-applet-graphics/src/window.rs @@ -1,23 +1,22 @@ use crate::dbus::{self, PowerDaemonProxy}; use crate::fl; use crate::graphics::{get_current_graphics, set_graphics, Graphics}; -use cosmic::applet::CosmicAppletHelper; use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; -use cosmic::iced_native::alignment::Horizontal; -use cosmic::iced_native::Alignment; +use cosmic::iced::Color; +use cosmic::iced_runtime::core::alignment::Horizontal; +use cosmic::iced_runtime::core::Alignment; use cosmic::iced_style::application::{self, Appearance}; -use cosmic::iced_style::Color; use cosmic::theme::Button; use cosmic::widget::icon; use cosmic::{ - applet::{cosmic_panel_config::PanelAnchor, APPLET_BUTTON_THEME}, iced::widget::{column, container, row, text}, iced::{self, Application, Command, Length}, - iced_native::window, + iced_runtime::core::window, theme::{Svg, Theme}, widget::{button, divider}, Element, }; +use cosmic_applet::{applet_button_theme, cosmic_panel_config::PanelAnchor, CosmicAppletHelper}; use zbus::Connection; #[derive(Clone, Copy)] @@ -41,7 +40,7 @@ impl GraphicsMode { pub struct Window { popup: Option, graphics_mode: Option, - id_ctr: u32, + id_ctr: u128, theme: Theme, dbus: Option<(Connection, PowerDaemonProxy<'static>)>, applet_helper: CosmicAppletHelper, @@ -92,7 +91,7 @@ impl Application for Window { return destroy_popup(p); } else { self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut commands = Vec::new(); if let Some((_, proxy)) = self.dbus.as_ref() { @@ -102,7 +101,7 @@ impl Application for Window { )); } let popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -184,7 +183,7 @@ impl Application for Window { } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { + if id == window::Id(0) { match self.applet_helper.anchor { PanelAnchor::Left | PanelAnchor::Right => self .applet_helper @@ -206,6 +205,7 @@ impl Application for Window { Some(Graphics::Hybrid) => fl!("hybrid"), None => "".into(), }) + .size(14) ] .spacing(8) .padding([0, self.applet_helper.suggested_size().0 / 2]) @@ -220,7 +220,7 @@ impl Application for Window { } } else { let content_list = vec![ - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(format!("{} {}", fl!("integrated"), fl!("graphics"))).size(14), @@ -256,7 +256,7 @@ impl Application for Window { .on_press(Message::SelectGraphicsMode(Graphics::Integrated)) .width(Length::Fill) .into(), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14),] .width(Length::Fill), @@ -289,7 +289,7 @@ impl Application for Window { .on_press(Message::SelectGraphicsMode(Graphics::Nvidia)) .width(Length::Fill) .into(), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(format!("{} {}", fl!("hybrid"), fl!("graphics"))).size(14), @@ -325,7 +325,7 @@ impl Application for Window { .on_press(Message::SelectGraphicsMode(Graphics::Hybrid)) .width(Length::Fill) .into(), - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![row![ column![ text(format!("{} {}", fl!("compute"), fl!("graphics"))).size(14), @@ -369,7 +369,7 @@ impl Application for Window { text(fl!("graphics-mode")) .width(Length::Fill) .horizontal_alignment(Horizontal::Center) - .size(24) + .size(14) .into(), container(divider::horizontal::light()) .padding([0, 12]) @@ -385,7 +385,7 @@ impl Application for Window { } fn close_requested(&self, id: window::Id) -> Self::Message { - if id != window::Id::new(0) { + if id != window::Id(0) { Message::PopupClosed(id) } else { unimplemented!(); @@ -393,10 +393,10 @@ impl Application for Window { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().background.on.into(), - }) + })) } fn should_exit(&self) -> bool { @@ -404,6 +404,6 @@ impl Application for Window { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } } diff --git a/cosmic-applet-network/Cargo.toml b/cosmic-applet-network/Cargo.toml index 93d23c53..214c1c69 100644 --- a/cosmic-applet-network/Cargo.toml +++ b/cosmic-applet-network/Cargo.toml @@ -9,11 +9,12 @@ once_cell = "1.16.0" cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bindings", branch = "main" } # cosmic-dbus-networkmanager = { path = "../../../dbus-settings-bindings/networkmanager" } futures-util = "0.3.21" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +cosmic-applet = { path = "../applet" } futures = "0.3" -zbus = { version = "3.7", default-features = false } +zbus = { version = "3.13", default-features = false } log = "0.4" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" itertools = "0.10.3" slotmap = "1.0.6" tokio = { version = "1.15.0", features = ["full"] } @@ -22,3 +23,5 @@ anyhow = "1.0" i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.6.4" rust-embed = "6.3.0" +rust-embed-utils = "7.5.0" + diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index 8dc02d41..8b7986db 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -1,15 +1,14 @@ use cosmic::iced_style; +use cosmic::iced_widget::Row; use cosmic::{ - applet::CosmicAppletHelper, iced::{ wayland::popup::{destroy_popup, get_popup}, widget::{column, container, row, scrollable, text, text_input, Column}, Alignment, Application, Color, Command, Length, Subscription, }, - iced_native::{ + iced_runtime::core::{ alignment::{Horizontal, Vertical}, layout::Limits, - renderer::BorderRadius, window, }, iced_style::{application, button::StyleSheet}, @@ -17,9 +16,14 @@ use cosmic::{ widget::{button, divider, icon, toggler}, Element, Theme, }; +use cosmic_applet::CosmicAppletHelper; use cosmic_dbus_networkmanager::interface::enums::{ActiveConnectionState, DeviceState}; use futures::channel::mpsc::UnboundedSender; +use zbus::Connection; +use crate::network_manager::active_conns::active_conns_subscription; +use crate::network_manager::devices::devices_subscription; +use crate::network_manager::wireless_enabled::wireless_enabled_subscription; use crate::network_manager::NetworkManagerState; use crate::{ config, fl, @@ -77,13 +81,14 @@ struct CosmicNetworkApplet { icon_name: String, theme: Theme, popup: Option, - id_ctr: u32, + id_ctr: u128, applet_helper: CosmicAppletHelper, nm_state: NetworkManagerState, // UI state nm_sender: Option>, show_visible_networks: bool, new_connection: Option, + conn: Option, } impl CosmicNetworkApplet { @@ -110,7 +115,7 @@ impl CosmicNetworkApplet { } #[derive(Debug, Clone)] -enum Message { +pub(crate) enum Message { ActivateKnownWifi(String), Disconnect(String), TogglePopup, @@ -155,11 +160,11 @@ impl Application for CosmicNetworkApplet { } else { // TODO request update of state maybe self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -167,10 +172,10 @@ impl Application for CosmicNetworkApplet { ); popup_settings.positioner.size_limits = Limits::NONE - .min_height(1) - .min_width(1) - .max_height(800) - .max_width(400); + .min_height(1.0) + .min_width(1.0) + .max_height(800.0) + .max_width(400.0); return get_popup(popup_settings); } } @@ -193,10 +198,15 @@ impl Application for CosmicNetworkApplet { } } Message::NetworkManagerEvent(event) => match event { - NetworkManagerEvent::Init { sender, state } => { + NetworkManagerEvent::Init { + conn, + sender, + state, + } => { self.nm_sender.replace(sender); self.nm_state = state; self.update_icon_name(); + self.conn = Some(conn); } NetworkManagerEvent::WiFiEnabled(state) => { self.nm_state = state; @@ -337,17 +347,17 @@ impl Application for CosmicNetworkApplet { Command::none() } fn view(&self, id: window::Id) -> Element { - let button_style = Button::Custom { - active: |t| iced_style::button::Appearance { - border_radius: BorderRadius::from(0.0), + let button_style = || Button::Custom { + active: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, ..t.active(&Button::Text) - }, - hover: |t| iced_style::button::Appearance { - border_radius: BorderRadius::from(0.0), + }), + hover: Box::new(|t| iced_style::button::Appearance { + border_radius: 0.0, ..t.hovered(&Button::Text) - }, + }), }; - if id == window::Id::new(0) { + if id == window::Id(0) { self.applet_helper .icon_button(&self.icon_name) .on_press(Message::TogglePopup) @@ -362,7 +372,7 @@ impl Application for CosmicNetworkApplet { for addr in ip_addresses { ipv4.push( text(format!("{}: {}", fl!("ipv4"), addr.to_string())) - .size(12) + .size(10) .into(), ); } @@ -412,8 +422,6 @@ impl Application for CosmicNetworkApplet { let mut btn_content = vec![ icon("network-wireless-symbolic", 24) .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)) .into(), column![text(name).size(14), Column::with_children(ipv4)] .width(Length::Fill) @@ -425,8 +433,6 @@ impl Application for CosmicNetworkApplet { btn_content.push( icon("process-working-symbolic", 24) .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)) .into(), ); } @@ -441,9 +447,12 @@ impl Application for CosmicNetworkApplet { }; known_wifi = known_wifi.push( column![button(Button::Secondary) - .custom(btn_content) + .custom(vec![Row::with_children(btn_content) + .align_items(Alignment::Center) + .spacing(8) + .into()]) .padding([8, 24]) - .style(button_style.clone()) + .style(button_style()) .on_press(Message::Disconnect(name.clone()))] .align_items(Alignment::Center), ); @@ -454,8 +463,6 @@ impl Application for CosmicNetworkApplet { let mut btn_content = vec![ icon("network-wireless-symbolic", 24) .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)) .into(), text(&known.ssid).size(14).width(Length::Fill).into(), ]; @@ -464,17 +471,18 @@ impl Application for CosmicNetworkApplet { btn_content.push( icon("process-working-symbolic", 24) .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)) .into(), ); } let mut btn = button(Button::Secondary) - .custom(btn_content) + .custom(vec![Row::with_children(btn_content) + .align_items(Alignment::Center) + .spacing(8) + .into()]) .padding([8, 24]) .width(Length::Fill) - .style(button_style.clone()); + .style(button_style()); btn = match known.state { DeviceState::Failed | DeviceState::Unknown @@ -495,6 +503,7 @@ impl Application for CosmicNetworkApplet { toggler(fl!("airplane-mode"), self.nm_state.airplane_mode, |m| { Message::ToggleAirplaneMode(m) }) + .text_size(14) .width(Length::Fill) ) .padding([0, 12]), @@ -503,6 +512,7 @@ impl Application for CosmicNetworkApplet { toggler(fl!("wifi"), self.nm_state.wifi_enabled, |m| { Message::ToggleWiFi(m) }) + .text_size(14) .width(Length::Fill) ) .padding([0, 12]), @@ -523,25 +533,20 @@ impl Application for CosmicNetworkApplet { text(fl!("visible-wireless-networks")) .size(14) .width(Length::Fill) - .height(Length::Units(24)) + .height(Length::Fixed(24.0)) .vertical_alignment(Vertical::Center) .into(), - container( - icon(dropdown_icon, 14) - .style(Svg::Symbolic) - .width(Length::Units(14)) - .height(Length::Units(14)), - ) - .align_x(Horizontal::Center) - .align_y(Vertical::Center) - .width(Length::Units(24)) - .height(Length::Units(24)) - .into(), + container(icon(dropdown_icon, 14).style(Svg::Symbolic)) + .align_x(Horizontal::Center) + .align_y(Vertical::Center) + .width(Length::Fixed(24.0)) + .height(Length::Fixed(24.0)) + .into(), ] .into(), ) .padding([8, 24]) - .style(button_style.clone()) + .style(button_style()) .on_press(Message::ToggleVisibleNetworks); content = content.push(available_connections_btn); if self.show_visible_networks { @@ -552,10 +557,7 @@ impl Application for CosmicNetworkApplet { password, } => { let id = row![ - icon("network-wireless-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("network-wireless-symbolic", 24).style(Svg::Symbolic), text(&access_point.ssid).size(14), ] .align_items(Alignment::Center) @@ -565,7 +567,9 @@ impl Application for CosmicNetworkApplet { content = content.push(id); let col = column![ text(fl!("enter-password")), - text_input("", password, Message::Password) + text_input("", password) + .on_input(Message::Password) + .on_paste(Message::Password) .on_submit(Message::SubmitPassword) .password(), container(text(fl!("router-wps-button"))).padding(8), @@ -590,10 +594,7 @@ impl Application for CosmicNetworkApplet { } NewConnectionState::Waiting(access_point) => { let id = row![ - icon("network-wireless-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("network-wireless-symbolic", 24).style(Svg::Symbolic), text(&access_point.ssid).size(14), ] .align_items(Alignment::Center) @@ -601,10 +602,7 @@ impl Application for CosmicNetworkApplet { .spacing(12); let connecting = row![ id, - icon("process-working-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("process-working-symbolic", 24).style(Svg::Symbolic), ] .spacing(8) .padding([0, 24]); @@ -612,10 +610,7 @@ impl Application for CosmicNetworkApplet { } NewConnectionState::Failure(access_point) => { let id = row![ - icon("network-wireless-symbolic", 24) - .style(Svg::Symbolic) - .width(Length::Units(24)) - .height(Length::Units(24)), + icon("network-wireless-symbolic", 24).style(Svg::Symbolic), text(&access_point.ssid).size(14), ] .align_items(Alignment::Center) @@ -660,15 +655,12 @@ impl Application for CosmicNetworkApplet { { continue; } - let button = button(button_style) + let button = button(button_style()) .custom(vec![row![ - icon("network-wireless-symbolic", 16) - .style(Svg::Symbolic) - .width(Length::Units(16)) - .height(Length::Units(16)), + icon("network-wireless-symbolic", 16).style(Svg::Symbolic), text(&ap.ssid) .size(14) - .height(Length::Units(24)) + .height(Length::Fixed(24.0)) .vertical_alignment(Vertical::Center) ] .align_items(Alignment::Center) @@ -680,7 +672,7 @@ impl Application for CosmicNetworkApplet { list_col.push(button.into()); } content = content.push( - scrollable(Column::with_children(list_col)).height(Length::Units(300)), + scrollable(Column::with_children(list_col)).height(Length::Fixed(300.0)), ); } } @@ -689,11 +681,25 @@ impl Application for CosmicNetworkApplet { } fn subscription(&self) -> Subscription { - network_manager_subscription(0).map(|(_, event)| Message::NetworkManagerEvent(event)) + let network_sub = + network_manager_subscription(0).map(|e| Message::NetworkManagerEvent(e.1)); + + if let Some(conn) = self.conn.as_ref() { + Subscription::batch(vec![ + network_sub, + active_conns_subscription(0, conn.clone()) + .map(|e| Message::NetworkManagerEvent(e.1)), + devices_subscription(0, conn.clone()).map(|e| Message::NetworkManagerEvent(e.1)), + wireless_enabled_subscription(0, conn.clone()) + .map(|e| Message::NetworkManagerEvent(e.1)), + ]) + } else { + network_sub + } } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -701,9 +707,11 @@ impl Application for CosmicNetworkApplet { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| application::Appearance { - background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), - text_color: theme.cosmic().on_bg_color().into(), - }) + ::Style::Custom(Box::new(|theme| { + application::Appearance { + background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), + text_color: theme.cosmic().on_bg_color().into(), + } + })) } } diff --git a/cosmic-applet-network/src/network_manager/active_conns.rs b/cosmic-applet-network/src/network_manager/active_conns.rs new file mode 100644 index 00000000..bc116e95 --- /dev/null +++ b/cosmic-applet-network/src/network_manager/active_conns.rs @@ -0,0 +1,56 @@ +use super::{NetworkManagerEvent, NetworkManagerState}; +use cosmic::iced::{self, subscription}; +use cosmic_dbus_networkmanager::nm::NetworkManager; +use futures::StreamExt; +use log::error; +use std::fmt::Debug; +use std::hash::Hash; +use zbus::Connection; + +pub fn active_conns_subscription( + id: I, + conn: Connection, +) -> iced::Subscription<(I, NetworkManagerEvent)> { + subscription::unfold(id, State::Continue(conn), move |mut state| async move { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } + }) +} + +#[derive(Debug, Clone)] +pub enum State { + Continue(Connection), + Error, +} + +async fn start_listening( + id: I, + state: State, +) -> (Option<(I, NetworkManagerEvent)>, State) { + let conn = match state { + State::Continue(conn) => conn, + State::Error => iced::futures::future::pending().await, + }; + let network_manager = match NetworkManager::new(&conn).await { + Ok(n) => n, + Err(e) => { + error!("Failed to connect to NetworkManager: {}", e); + return (None, State::Error); + } + }; + + let mut active_conns_changed = network_manager.receive_active_connections_changed().await; + active_conns_changed.next().await; + + let new_state = NetworkManagerState::new(&conn).await.unwrap_or_default(); + + ( + Some((id, NetworkManagerEvent::ActiveConns(new_state))), + State::Continue(conn), + ) +} diff --git a/cosmic-applet-network/src/network_manager/devices.rs b/cosmic-applet-network/src/network_manager/devices.rs new file mode 100644 index 00000000..e1365a96 --- /dev/null +++ b/cosmic-applet-network/src/network_manager/devices.rs @@ -0,0 +1,59 @@ +use super::{NetworkManagerEvent, NetworkManagerState}; +use cosmic::iced::{self, subscription}; +use cosmic_dbus_networkmanager::nm::NetworkManager; +use log::error; +use std::fmt::Debug; +use std::hash::Hash; +use zbus::Connection; +use futures::StreamExt; + +pub fn devices_subscription( + id: I, + conn: Connection, +) -> iced::Subscription<(I, NetworkManagerEvent)> { + subscription::unfold(id, State::Continue(conn), move |mut state| async move { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } + }) +} + +#[derive(Debug, Clone)] +pub enum State { + Continue(Connection), + Error, +} + +async fn start_listening( + id: I, + state: State, +) -> (Option<(I, NetworkManagerEvent)>, State) { + let conn = match state { + State::Continue(conn) => conn, + State::Error => iced::futures::future::pending().await, + }; + let network_manager = match NetworkManager::new(&conn).await { + Ok(n) => n, + Err(e) => { + error!("Failed to connect to NetworkManager: {}", e); + return (None, State::Error); + } + }; + + let mut devices_changed = network_manager.receive_devices_changed().await; + devices_changed.next().await; + + let new_state = NetworkManagerState::new(&conn).await.unwrap_or_default(); + + ( + Some(( + id, + NetworkManagerEvent::WirelessAccessPoints(new_state), + )), + State::Continue(conn), + ) +} diff --git a/cosmic-applet-network/src/network_manager/mod.rs b/cosmic-applet-network/src/network_manager/mod.rs index 72ac3707..5f87ef3f 100644 --- a/cosmic-applet-network/src/network_manager/mod.rs +++ b/cosmic-applet-network/src/network_manager/mod.rs @@ -1,5 +1,8 @@ +pub mod active_conns; pub mod available_wifi; pub mod current_networks; +pub mod devices; +pub mod wireless_enabled; use std::{collections::HashMap, fmt::Debug, hash::Hash, ops::Deref, time::Duration}; @@ -32,7 +35,9 @@ use self::{ pub fn network_manager_subscription( id: I, ) -> iced::Subscription<(I, NetworkManagerEvent)> { - subscription::unfold(id, State::Ready, move |state| start_listening(id, state)) + subscription::unfold(id, State::Ready, move |state| { + start_listening_loop(id, state) + }) } #[derive(Debug)] @@ -42,6 +47,19 @@ pub enum State { Finished, } +pub async fn start_listening_loop( + id: I, + mut state: State, +) -> ((I, NetworkManagerEvent), State) { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } +} + async fn start_listening( id: I, state: State, @@ -59,6 +77,7 @@ async fn start_listening( Some(( id, NetworkManagerEvent::Init { + conn: conn.clone(), sender: tx, state: nm_state, }, @@ -72,289 +91,402 @@ async fn start_listening( Err(_) => return (None, State::Finished), }; - let mut active_conns_changed = tokio::time::sleep(Duration::from_secs(5)) - .then(|_| async { network_manager.receive_active_connections_changed().await }) - .await; - let mut devices_changed = network_manager.receive_devices_changed().await; - let mut wireless_enabled_changed = - network_manager.receive_wireless_enabled_changed().await; - let mut req = rx.next().boxed().fuse(); - - let (update, should_exit) = futures::select! { - req = req => { - match req { - Some(NetworkManagerRequest::Disconnect(ssid)) => { - let mut success = false; - for c in network_manager.active_connections().await.unwrap_or_default() { - if c.id().await.unwrap_or_default() == ssid { - if let Ok(_) = network_manager.deactivate_connection(&c).await { - success = true; - } - } + let (update, should_exit) = match rx.next().await { + Some(NetworkManagerRequest::Disconnect(ssid)) => { + let mut success = false; + for c in network_manager + .active_connections() + .await + .unwrap_or_default() + { + if c.id().await.unwrap_or_default() == ssid { + if let Ok(_) = network_manager.deactivate_connection(&c).await { + success = true; } - (Some((id, - NetworkManagerEvent::RequestResponse { + } + } + ( + Some(( + id, + NetworkManagerEvent::RequestResponse { req: NetworkManagerRequest::Disconnect(ssid.clone()), success, state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false) + }, + )), + false, + ) + } + Some(NetworkManagerRequest::SetAirplaneMode(airplane_mode)) => { + // wifi + let mut success = network_manager + .set_wireless_enabled(!airplane_mode) + .await + .is_ok(); + // bluetooth + success = success + && Command::new("rfkill") + .arg(if airplane_mode { "block" } else { "unblock" }) + .arg("bluetooth") + .output() + .await + .is_ok(); + let response = NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::SetAirplaneMode(airplane_mode), + success, + state: NetworkManagerState::new(&conn).await.unwrap_or_default(), + }; + (Some((id, response)), false) + } + Some(NetworkManagerRequest::SetWiFi(enabled)) => { + let success = network_manager.set_wireless_enabled(enabled).await.is_ok(); + let response = NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::SetAirplaneMode(enabled), + success, + state: NetworkManagerState::new(&conn).await.unwrap_or_default(), + }; + (Some((id, response)), false) + } + Some(NetworkManagerRequest::Password(ssid, password)) => { + let s = match NetworkManagerSettings::new(&conn).await { + Ok(s) => s, + Err(_) => return (None, State::Finished), + }; + + let mut status = (None, false); + + // First try known connections + // TODO more convenient methods of managing settings + for c in s.list_connections().await.unwrap_or_default() { + let mut settings = match c.get_settings().await.ok() { + Some(s) => s, + None => continue, + }; + + let cur_ssid = settings + .get("802-11-wireless") + .and_then(|w| w.get("ssid")) + .cloned() + .and_then(|ssid| ssid.try_into().ok()) + .and_then(|ssid| String::from_utf8(ssid).ok()); + if cur_ssid.as_ref() != Some(&ssid) { + continue; } - Some(NetworkManagerRequest::SetAirplaneMode(airplane_mode)) => { - // wifi - let mut success = network_manager.set_wireless_enabled(!airplane_mode).await.is_ok(); - // bluetooth - success = success && Command::new("rfkill") - .arg(if airplane_mode { "block" } else { "unblock" }) - .arg("bluetooth") - .output() - .await - .is_ok(); - let response = NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::SetAirplaneMode(airplane_mode), - success, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - }; - (Some((id, response)), false) - } - Some(NetworkManagerRequest::SetWiFi(enabled)) => { - let success = network_manager.set_wireless_enabled(enabled).await.is_ok(); - let response = NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::SetAirplaneMode(enabled), - success, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - }; - (Some((id, response)), false) - } - Some(NetworkManagerRequest::Password(ssid, password)) => { - let s = match NetworkManagerSettings::new(&conn).await { - Ok(s) => s, - Err(_) => return (None, State::Finished), - }; - let mut status = (None, false); - - // First try known connections - // TODO more convenient methods of managing settings - for c in s.list_connections().await.unwrap_or_default() { - let mut settings = match c.get_settings().await.ok() { - Some(s) => s, - None => continue, - }; - - let cur_ssid = settings - .get("802-11-wireless") - .and_then(|w| w.get("ssid")) - .cloned() - .and_then(|ssid| ssid.try_into().ok()) - .and_then(|ssid| String::from_utf8(ssid).ok()); - if cur_ssid.as_ref() != Some(&ssid) { - continue; - } - - let mut secrets = match - c.get_secrets("802-11-wireless-security") - .await { - Ok(s) => s, - _ => HashMap::from([("802-11-wireless-security".into(), HashMap::from([ - ("psk".into(), Value::Str(password.as_str().into()).to_owned()), - ("key-mgmt".into(), Value::Str("wpa-psk".into()).to_owned()) - ]))]), - }; - if let Some(s) = secrets.get_mut("802-11-wireless-security") { - s.insert("psk".into(), Value::Str(password.clone().into()).to_owned()); - drop(s); - settings.extend(secrets.into_iter()); - let settings: HashMap<_, _> = settings.iter().map(|(k, v)| { - let map = (k.as_str(), v.iter() + let mut secrets = match c.get_secrets("802-11-wireless-security").await { + Ok(s) => s, + _ => HashMap::from([( + "802-11-wireless-security".into(), + HashMap::from([ + ( + "psk".into(), + Value::Str(password.as_str().into()).to_owned(), + ), + ("key-mgmt".into(), Value::Str("wpa-psk".into()).to_owned()), + ]), + )]), + }; + if let Some(s) = secrets.get_mut("802-11-wireless-security") { + s.insert("psk".into(), Value::Str(password.clone().into()).to_owned()); + drop(s); + settings.extend(secrets.into_iter()); + let settings: HashMap<_, _> = settings + .iter() + .map(|(k, v)| { + let map = ( + k.as_str(), + v.iter() .map(|(k, v)| (k.as_str(), v.into())) - .collect::>()); - map - }).collect(); - let updated = c.update(settings).await; - if updated.is_ok() { - let success = if let Ok(path) = network_manager.deref().activate_connection(c.deref().path(), &ObjectPath::try_from("/").unwrap(), &ObjectPath::try_from("/").unwrap()).await { - // let active_conn = ActiveConnection::from(ActiveConnectionProxy::from(conn.1)); - let dummy = ActiveConnectionProxy::new(&conn).await.unwrap(); - let active = ActiveConnectionProxy::builder(&conn).path(path).unwrap().destination(dummy.destination()).unwrap().interface(dummy.interface()).unwrap().build().await.unwrap(); - let state = enums::ActiveConnectionState::from(active.state().await.unwrap_or_default()); - let s = if let enums::ActiveConnectionState::Activating = state { - if let Ok(Some(s)) = timeout(Duration::from_secs(10), active.receive_state_changed().await.next()).await { - s.get().await.unwrap_or_default().into() - } else { - state - } - } else { - state - }; - matches!(s, enums::ActiveConnectionState::Activated) - } else { - false - }; - status = (Some((id, NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::Password(ssid.clone(), password.clone()), - success, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false); - } - - break; - } - } - - // create a connection - if status.0.is_none() { - for device in network_manager.devices().await.ok().unwrap_or_default() { - if matches!(device.device_type().await.unwrap_or(DeviceType::Other), DeviceType::Wifi) { - let conn_settings: HashMap<&str, HashMap<&str, zvariant::Value>> = HashMap::from([ - ("802-11-wireless".into(), HashMap::from([ - ("ssid".into(), Value::Array(ssid.as_bytes().into())), - ])), - ("connection".into(), HashMap::from([ - ("id".into(), Value::Str(ssid.as_str().into())), - ("type".into(), Value::Str("802-11-wireless".into())), - ])), - ("802-11-wireless-security".into(), HashMap::from([ - ("psk".into(), Value::Str(password.as_str().into())), - ("key-mgmt".into(), Value::Str("wpa-psk".into())) - ])) - ]); - let success = if let Ok((_, path)) = network_manager.add_and_activate_connection(conn_settings, device.path(), &ObjectPath::try_from("/").unwrap()).await { - let dummy = ActiveConnectionProxy::new(&conn).await.unwrap(); - let active = ActiveConnectionProxy::builder(&conn).path(path).unwrap().destination(dummy.destination()).unwrap().interface(dummy.interface()).unwrap().build().await.unwrap(); - let state = enums::ActiveConnectionState::from(active.state().await.unwrap_or_default()); - let s = if let enums::ActiveConnectionState::Activating = state { - if let Ok(Some(s)) = timeout(Duration::from_secs(10), active.receive_state_changed().await.next()).await { - s.get().await.unwrap_or_default().into() - } else { - state - } - } else { - state - }; - matches!(s, enums::ActiveConnectionState::Activated) - } else { - false - }; - status = (Some((id, NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::Password(ssid.clone(), password.clone()), - success, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false); - - break; - } - } - } - - if status.0.is_none() { - status = (Some((id, NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::Password(ssid, password), - success: false, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false); - } - - status - } - Some(NetworkManagerRequest::SelectAccessPoint(ssid)) => { - let s = match NetworkManagerSettings::new(&conn).await { - Ok(s) => s, - Err(_) => return (None, State::Finished), - }; - // find known connection with matching ssid and activate - let mut status = (None, false); - - for c in s.list_connections().await.unwrap_or_default() { - let settings = match c.get_settings().await.ok() { - Some(s) => s, - None => continue, - }; - - let cur_ssid = settings - .get("802-11-wireless") - .and_then(|w| w.get("ssid")) - .cloned() - .and_then(|ssid| ssid.try_into().ok()) - .and_then(|ssid| String::from_utf8(ssid).ok()); - - if cur_ssid.as_ref() != Some(&ssid) { - continue; - } - - let success = if let Ok(path) = network_manager.deref().activate_connection(c.deref().path(), &ObjectPath::try_from("/").unwrap(), &ObjectPath::try_from("/").unwrap()).await { + .collect::>(), + ); + map + }) + .collect(); + let updated = c.update(settings).await; + if updated.is_ok() { + let success = if let Ok(path) = network_manager + .deref() + .activate_connection( + c.deref().path(), + &ObjectPath::try_from("/").unwrap(), + &ObjectPath::try_from("/").unwrap(), + ) + .await + { + // let active_conn = ActiveConnection::from(ActiveConnectionProxy::from(conn.1)); let dummy = ActiveConnectionProxy::new(&conn).await.unwrap(); - let active = ActiveConnectionProxy::builder(&conn).path(path).unwrap().destination(dummy.destination()).unwrap().interface(dummy.interface()).unwrap().build().await.unwrap(); - let mut state = enums::ActiveConnectionState::from(active.state().await.unwrap_or_default()); - while let enums::ActiveConnectionState::Activating = state { - if let Ok(Some(s)) = timeout(Duration::from_secs(20), active.receive_state_changed().await.next()).await { - state = s.get().await.unwrap_or_default().into(); + let active = ActiveConnectionProxy::builder(&conn) + .path(path) + .unwrap() + .destination(dummy.destination()) + .unwrap() + .interface(dummy.interface()) + .unwrap() + .build() + .await + .unwrap(); + let state = enums::ActiveConnectionState::from( + active.state().await.unwrap_or_default(), + ); + let s = if let enums::ActiveConnectionState::Activating = state + { + if let Ok(Some(s)) = timeout( + Duration::from_secs(10), + active.receive_state_changed().await.next(), + ) + .await + { + s.get().await.unwrap_or_default().into() } else { - break; + state } + } else { + state }; - matches!(state, enums::ActiveConnectionState::Activated) + matches!(s, enums::ActiveConnectionState::Activated) } else { false }; - status = (Some((id, NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::SelectAccessPoint(ssid.clone()), - success, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false); + status = ( + Some(( + id, + NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::Password( + ssid.clone(), + password.clone(), + ), + success, + state: NetworkManagerState::new(&conn) + .await + .unwrap_or_default(), + }, + )), + false, + ); + } + + break; + } + } + + // create a connection + if status.0.is_none() { + for device in network_manager.devices().await.ok().unwrap_or_default() { + if matches!( + device.device_type().await.unwrap_or(DeviceType::Other), + DeviceType::Wifi + ) { + let conn_settings: HashMap<&str, HashMap<&str, zvariant::Value>> = + HashMap::from([ + ( + "802-11-wireless".into(), + HashMap::from([( + "ssid".into(), + Value::Array(ssid.as_bytes().into()), + )]), + ), + ( + "connection".into(), + HashMap::from([ + ("id".into(), Value::Str(ssid.as_str().into())), + ( + "type".into(), + Value::Str("802-11-wireless".into()), + ), + ]), + ), + ( + "802-11-wireless-security".into(), + HashMap::from([ + ( + "psk".into(), + Value::Str(password.as_str().into()), + ), + ("key-mgmt".into(), Value::Str("wpa-psk".into())), + ]), + ), + ]); + let success = if let Ok((_, path)) = network_manager + .add_and_activate_connection( + conn_settings, + device.path(), + &ObjectPath::try_from("/").unwrap(), + ) + .await + { + let dummy = ActiveConnectionProxy::new(&conn).await.unwrap(); + let active = ActiveConnectionProxy::builder(&conn) + .path(path) + .unwrap() + .destination(dummy.destination()) + .unwrap() + .interface(dummy.interface()) + .unwrap() + .build() + .await + .unwrap(); + let state = enums::ActiveConnectionState::from( + active.state().await.unwrap_or_default(), + ); + let s = if let enums::ActiveConnectionState::Activating = state + { + if let Ok(Some(s)) = timeout( + Duration::from_secs(10), + active.receive_state_changed().await.next(), + ) + .await + { + s.get().await.unwrap_or_default().into() + } else { + state + } + } else { + state + }; + matches!(s, enums::ActiveConnectionState::Activated) + } else { + false + }; + status = ( + Some(( + id, + NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::Password( + ssid.clone(), + password.clone(), + ), + success, + state: NetworkManagerState::new(&conn) + .await + .unwrap_or_default(), + }, + )), + false, + ); break; } + } + } - if status.0.is_none() { - status = (Some((id, NetworkManagerEvent::RequestResponse { + if status.0.is_none() { + status = ( + Some(( + id, + NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::Password(ssid, password), + success: false, + state: NetworkManagerState::new(&conn) + .await + .unwrap_or_default(), + }, + )), + false, + ); + } + + status + } + Some(NetworkManagerRequest::SelectAccessPoint(ssid)) => { + let s = match NetworkManagerSettings::new(&conn).await { + Ok(s) => s, + Err(_) => return (None, State::Finished), + }; + // find known connection with matching ssid and activate + let mut status = (None, false); + + for c in s.list_connections().await.unwrap_or_default() { + let settings = match c.get_settings().await.ok() { + Some(s) => s, + None => continue, + }; + + let cur_ssid = settings + .get("802-11-wireless") + .and_then(|w| w.get("ssid")) + .cloned() + .and_then(|ssid| ssid.try_into().ok()) + .and_then(|ssid| String::from_utf8(ssid).ok()); + + if cur_ssid.as_ref() != Some(&ssid) { + continue; + } + + let success = if let Ok(path) = network_manager + .deref() + .activate_connection( + c.deref().path(), + &ObjectPath::try_from("/").unwrap(), + &ObjectPath::try_from("/").unwrap(), + ) + .await + { + let dummy = ActiveConnectionProxy::new(&conn).await.unwrap(); + let active = ActiveConnectionProxy::builder(&conn) + .path(path) + .unwrap() + .destination(dummy.destination()) + .unwrap() + .interface(dummy.interface()) + .unwrap() + .build() + .await + .unwrap(); + let mut state = enums::ActiveConnectionState::from( + active.state().await.unwrap_or_default(), + ); + while let enums::ActiveConnectionState::Activating = state { + if let Ok(Some(s)) = timeout( + Duration::from_secs(20), + active.receive_state_changed().await.next(), + ) + .await + { + state = s.get().await.unwrap_or_default().into(); + } else { + break; + } + } + matches!(state, enums::ActiveConnectionState::Activated) + } else { + false + }; + status = ( + Some(( + id, + NetworkManagerEvent::RequestResponse { + req: NetworkManagerRequest::SelectAccessPoint(ssid.clone()), + success, + state: NetworkManagerState::new(&conn) + .await + .unwrap_or_default(), + }, + )), + false, + ); + + break; + } + + if status.0.is_none() { + status = ( + Some(( + id, + NetworkManagerEvent::RequestResponse { req: NetworkManagerRequest::SelectAccessPoint(ssid.clone()), success: false, - state: NetworkManagerState::new(&conn).await.unwrap_or_default(), - })), false); - } - status - } - None => { - (None, true) - } - }} - _ = active_conns_changed.next().boxed().fuse() => { - (Some((id, NetworkManagerEvent::ActiveConns(NetworkManagerState::new(&conn).await.unwrap_or_default()))), false) - } - _ = devices_changed.next().boxed().fuse() => { - let devices = network_manager.devices().await.ok().unwrap_or_default(); - let wireless_access_point_futures: Vec<_> = devices.into_iter().map(|device| async move { - if let Ok(Some(SpecificDevice::Wireless(wireless_device))) = - device.downcast_to_device().await - { - handle_wireless_device(wireless_device).await.unwrap_or_default() - } else { - Vec::new() - } - }).collect(); - let mut wireless_access_points = Vec::with_capacity(wireless_access_point_futures.len()); - for f in wireless_access_point_futures { - wireless_access_points.append(&mut f.await); + state: NetworkManagerState::new(&conn) + .await + .unwrap_or_default(), + }, + )), + false, + ); } - (Some((id, NetworkManagerEvent::WirelessAccessPoints(NetworkManagerState::new(&conn).await.unwrap_or_default()))), false) - } - enabled = wireless_enabled_changed.next().boxed().fuse() => { - let update = if let Some(update) = enabled { - if let Ok(_) = update.get().await { - Some((id, NetworkManagerEvent::WiFiEnabled(NetworkManagerState::new(&conn).await.unwrap_or_default()))) - } - else { - None - } - } else { - None - }; - (update, false) + status } + None => (None, true), }; - drop(active_conns_changed); - drop(wireless_enabled_changed); - drop(req); ( update, if should_exit { @@ -385,6 +517,7 @@ pub enum NetworkManagerEvent { success: bool, }, Init { + conn: Connection, sender: UnboundedSender, state: NetworkManagerState, }, diff --git a/cosmic-applet-network/src/network_manager/wireless_enabled.rs b/cosmic-applet-network/src/network_manager/wireless_enabled.rs new file mode 100644 index 00000000..e79f498d --- /dev/null +++ b/cosmic-applet-network/src/network_manager/wireless_enabled.rs @@ -0,0 +1,56 @@ +use super::{NetworkManagerEvent, NetworkManagerState}; +use cosmic::iced::{self, subscription}; +use cosmic_dbus_networkmanager::nm::NetworkManager; +use futures::StreamExt; +use log::error; +use std::fmt::Debug; +use std::hash::Hash; +use zbus::Connection; + +pub fn wireless_enabled_subscription( + id: I, + conn: Connection, +) -> iced::Subscription<(I, NetworkManagerEvent)> { + subscription::unfold(id, State::Continue(conn), move |mut state| async move { + loop { + let (update, new_state) = start_listening(id, state).await; + state = new_state; + if let Some(update) = update { + return (update, state); + } + } + }) +} + +#[derive(Debug, Clone)] +pub enum State { + Continue(Connection), + Error, +} + +async fn start_listening( + id: I, + state: State, +) -> (Option<(I, NetworkManagerEvent)>, State) { + let conn = match state { + State::Continue(conn) => conn, + State::Error => iced::futures::future::pending().await, + }; + let network_manager = match NetworkManager::new(&conn).await { + Ok(n) => n, + Err(e) => { + error!("Failed to connect to NetworkManager: {}", e); + return (None, State::Error); + } + }; + + let mut wireless_enabled_changed = network_manager.receive_wireless_enabled_changed().await; + wireless_enabled_changed.next().await; + + let new_state = NetworkManagerState::new(&conn).await.unwrap_or_default(); + + ( + Some((id, NetworkManagerEvent::WiFiEnabled(new_state))), + State::Continue(conn), + ) +} diff --git a/cosmic-applet-notifications/Cargo.toml b/cosmic-applet-notifications/Cargo.toml index 7974d7ae..19d8e2cf 100644 --- a/cosmic-applet-notifications/Cargo.toml +++ b/cosmic-applet-notifications/Cargo.toml @@ -6,5 +6,6 @@ license = "GPL-3.0-or-later" [dependencies] icon-loader = { version = "0.3.6", features = ["gtk"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } nix = "0.24.1" diff --git a/cosmic-applet-notifications/src/main.rs b/cosmic-applet-notifications/src/main.rs index 0d7aee4d..a1942e68 100644 --- a/cosmic-applet-notifications/src/main.rs +++ b/cosmic-applet-notifications/src/main.rs @@ -1,14 +1,13 @@ -use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME}; -use cosmic::iced::wayland::{ - popup::{destroy_popup, get_popup}, -}; +use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; use cosmic::iced::{ widget::{button, column, row, text, Row, Space}, window, Alignment, Application, Color, Command, Length, Subscription, }; +use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; use cosmic::iced_style::application::{self, Appearance}; +use cosmic::iced_widget::Button; use cosmic::theme::Svg; use cosmic::widget::{divider, icon, toggler}; use cosmic::Renderer; @@ -27,7 +26,7 @@ struct Notifications { theme: Theme, icon_name: String, popup: Option, - id_ctr: u32, + id_ctr: u128, do_not_disturb: bool, notifications: Vec>, } @@ -61,7 +60,7 @@ impl Application for Notifications { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -69,10 +68,10 @@ impl Application for Notifications { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } fn subscription(&self) -> Subscription { @@ -86,11 +85,11 @@ impl Application for Notifications { destroy_popup(p) } else { self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -112,7 +111,7 @@ impl Application for Notifications { } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { + if id == window::Id(0) { self.applet_helper .icon_button(&self.icon_name) .on_press(Message::TogglePopup) @@ -164,11 +163,9 @@ impl Application for Notifications { } // todo put into libcosmic doing so will fix the row_button's boarder radius -fn row_button( - mut content: Vec>, -) -> cosmic::iced_native::widget::Button { - content.insert(0, Space::with_width(Length::Units(24)).into()); - content.push(Space::with_width(Length::Units(24)).into()); +fn row_button(mut content: Vec>) -> Button { + content.insert(0, Space::with_width(Length::Fixed(24.0)).into()); + content.push(Space::with_width(Length::Fixed(24.0)).into()); button( Row::with_children(content) @@ -176,8 +173,8 @@ fn row_button( .align_items(Alignment::Center), ) .width(Length::Fill) - .height(Length::Units(36)) - .style(APPLET_BUTTON_THEME) + .height(Length::Fixed(36.0)) + .style(applet_button_theme()) } fn text_icon(name: &str, size: u16) -> cosmic::widget::Icon { diff --git a/cosmic-applet-power/Cargo.toml b/cosmic-applet-power/Cargo.toml index 7d7c97cf..cd6b41ed 100644 --- a/cosmic-applet-power/Cargo.toml +++ b/cosmic-applet-power/Cargo.toml @@ -9,7 +9,15 @@ icon-loader = { version = "0.3.6", features = ["gtk"] } libpulse-binding = "2.26.0" libpulse-glib-binding = "2.25.0" tokio = { version = "1.20.1", features=["full"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } -nix = "0.26.1" -zbus = "3.7" +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } +nix = "0.26.2" +zbus = "3.13" logind-zbus = "3.1" +# Application i18n +i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester"] } +i18n-embed-fl = "0.6" +rust-embed = "6.6" +rust-embed-utils = "7.5.0" +once_cell = "1.17.1" + diff --git a/cosmic-applet-power/i18n.toml b/cosmic-applet-power/i18n.toml new file mode 100644 index 00000000..05c50ba2 --- /dev/null +++ b/cosmic-applet-power/i18n.toml @@ -0,0 +1,4 @@ +fallback_language = "en" + +[fluent] +assets_dir = "i18n" \ No newline at end of file diff --git a/cosmic-applet-power/i18n/en/cosmic_applet_power.ftl b/cosmic-applet-power/i18n/en/cosmic_applet_power.ftl new file mode 100644 index 00000000..7650d4af --- /dev/null +++ b/cosmic-applet-power/i18n/en/cosmic_applet_power.ftl @@ -0,0 +1,21 @@ +power = Power +settings = Settings... +lock-screen = Lock Screen +lock-screen-shortcut = Super + Escape +log-out = Log Out +log-out-shortcut = Ctrl + Alt + Delete +suspend = Suspend +restart = Restart +shutdown = Shutdown +confirm = Confirm +cancel = Cancel +confirm-question = + Are you sure? { $action -> + [restart] { restart } + [suspend] { suspend } + [shutdown] { shutdown } + [lock-screen] Locking the screen + [log-out] Logging out + *[other] The selected action + } will continue in { $countdown } seconds. + diff --git a/cosmic-applet-power/src/localize.rs b/cosmic-applet-power/src/localize.rs new file mode 100644 index 00000000..baa05d0d --- /dev/null +++ b/cosmic-applet-power/src/localize.rs @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MPL-2.0-only + +use i18n_embed::{ + fluent::{fluent_language_loader, FluentLanguageLoader}, + DefaultLocalizer, LanguageLoader, Localizer, +}; +use once_cell::sync::Lazy; +use rust_embed::RustEmbed; + +#[derive(RustEmbed)] +#[folder = "i18n/"] +struct Localizations; + +pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { + let loader: FluentLanguageLoader = fluent_language_loader!(); + + loader + .load_fallback_language(&Localizations) + .expect("Error while loading fallback language"); + + loader +}); + +#[macro_export] +macro_rules! fl { + ($message_id:literal) => {{ + i18n_embed_fl::fl!($crate::localize::LANGUAGE_LOADER, $message_id) + }}; + + ($message_id:literal, $($args:expr),*) => {{ + i18n_embed_fl::fl!($crate::localize::LANGUAGE_LOADER, $message_id, $($args), *) + }}; +} + +// Get the `Localizer` to be used for localizing this library. +pub fn localizer() -> Box { + Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations)) +} + +pub fn localize() { + let localizer = localizer(); + let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages(); + + if let Err(error) = localizer.select(&requested_languages) { + eprintln!("Error while loading language for App List {}", error); + } +} diff --git a/cosmic-applet-power/src/main.rs b/cosmic-applet-power/src/main.rs index 8bb3f1c8..a1888a1e 100644 --- a/cosmic-applet-power/src/main.rs +++ b/cosmic-applet-power/src/main.rs @@ -1,18 +1,28 @@ +use std::collections::HashMap; use std::process; +use std::time::Duration; -use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME}; +use cosmic::iced::alignment::{Horizontal, Vertical}; +use cosmic::iced::event::wayland::{self, LayerEvent}; +use cosmic::iced::event::PlatformSpecific; +use cosmic::iced::subscription::events_with; +use cosmic::iced::wayland::actions::layer_surface::SctkLayerSurfaceSettings; use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; -use cosmic::iced_native::layout::Limits; -use cosmic::iced_native::widget::Space; +use cosmic::iced_runtime::core::layout::Limits; +use cosmic::iced_sctk::commands::layer_surface::{ + destroy_layer_surface, get_layer_surface, Anchor, KeyboardInteractivity, +}; +use cosmic::iced_widget::mouse_area; use cosmic::widget::{button, divider, icon}; use cosmic::Renderer; +use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; +use cosmic::iced::Color; use cosmic::iced::{ - widget::{self, column, container, row, Row}, + widget::{self, column, container, row, space::Space, text, Row}, window, Alignment, Application, Command, Length, Subscription, }; use cosmic::iced_style::application::{self, Appearance}; -use cosmic::iced_style::Color; use cosmic::theme::{self, Svg}; use cosmic::{Element, Theme}; @@ -20,9 +30,11 @@ use logind_zbus::manager::ManagerProxy; use logind_zbus::session::{SessionProxy, SessionType}; use logind_zbus::user::UserProxy; use nix::unistd::getuid; +use tokio::time::sleep; use zbus::Connection; pub mod cosmic_session; +mod localize; pub mod session_manager; use crate::cosmic_session::CosmicSessionProxy; @@ -39,19 +51,28 @@ struct Power { icon_name: String, theme: Theme, popup: Option, - id_ctr: u32, + id_ctr: u128, + action_to_confirm: Option<(window::Id, PowerAction)>, } -#[derive(Debug, Clone)] -enum Message { +#[derive(Debug, Clone, Copy)] +enum PowerAction { Lock, LogOut, Suspend, Restart, Shutdown, +} + +#[derive(Debug, Clone)] +enum Message { + Timeout(window::Id), + Action(PowerAction), TogglePopup, Settings, - Ignore, + Confirm, + Cancel, + Closed(window::Id), Zbus(Result<(), zbus::Error>), } @@ -72,26 +93,34 @@ impl Application for Power { } fn title(&self) -> String { - String::from("Power") + fl!("power") } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } - fn close_requested(&self, _id: window::Id) -> Self::Message { - Message::Ignore + fn close_requested(&self, id: window::Id) -> Self::Message { + Message::Closed(id) } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } fn subscription(&self) -> Subscription { - Subscription::none() + events_with(|e, _status| match e { + cosmic::iced::Event::PlatformSpecific(PlatformSpecific::Wayland( + wayland::Event::Layer(LayerEvent::Unfocused, ..), + )) => Some(Message::Cancel), + // cosmic::iced::Event::PlatformSpecific(PlatformSpecific::Wayland( + // wayland::Event::Seat(wayland::SeatEvent::Leave, _), + // )) => Some(Message::Cancel), + _ => None, + }) } fn update(&mut self, message: Message) -> Command { @@ -101,21 +130,21 @@ impl Application for Power { destroy_popup(p) } else { self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, None, ); popup_settings.positioner.size_limits = Limits::NONE - .min_width(100) - .min_height(100) - .max_height(400) - .max_width(500); + .min_width(100.0) + .min_height(100.0) + .max_height(400.0) + .max_width(500.0); get_popup(popup_settings) } } @@ -123,51 +152,117 @@ impl Application for Power { let _ = process::Command::new("cosmic-settings").spawn(); Command::none() } - Message::Lock => Command::perform(lock(), Message::Zbus), - Message::LogOut => Command::perform(log_out(), Message::Zbus), - Message::Suspend => Command::perform(suspend(), Message::Zbus), - Message::Restart => Command::perform(restart(), Message::Zbus), - Message::Shutdown => Command::perform(shutdown(), Message::Zbus), + Message::Action(action) => { + self.id_ctr += 1; + let id = window::Id(self.id_ctr); + self.action_to_confirm = Some((id, action)); + return Command::batch(vec![ + Command::perform(sleep(Duration::from_secs(60)), move |_| { + Message::Timeout(id) + }), + get_layer_surface(SctkLayerSurfaceSettings { + id, + keyboard_interactivity: KeyboardInteractivity::None, + anchor: Anchor::all(), + namespace: "dialog".into(), + size: Some((None, None)), + size_limits: Limits::NONE.min_width(1.0).min_height(1.0), + ..Default::default() + }), + ]); + } Message::Zbus(result) => { if let Err(e) = result { eprintln!("cosmic-applet-power ERROR: '{}'", e); } Command::none() } - Message::Ignore => Command::none(), + Message::Confirm => { + if let Some((id, a)) = self.action_to_confirm.take() { + Command::batch(vec![ + destroy_layer_surface(id), + match a { + PowerAction::Lock => Command::perform(lock(), Message::Zbus), + PowerAction::LogOut => Command::perform(log_out(), Message::Zbus), + PowerAction::Suspend => Command::perform(suspend(), Message::Zbus), + PowerAction::Restart => Command::perform(restart(), Message::Zbus), + PowerAction::Shutdown => Command::perform(shutdown(), Message::Zbus), + }, + ]) + } else { + Command::none() + } + } + Message::Cancel => { + if let Some((id, _)) = self.action_to_confirm.take() { + return destroy_layer_surface(id); + } + Command::none() + } + Message::Closed(id) => { + if let Some((surface_id, _)) = self.action_to_confirm { + if id == surface_id { + self.action_to_confirm = None; + return destroy_layer_surface(id); + } + } + if id == window::Id(0) { + process::exit(0); + } + Command::none() + } + Message::Timeout(id) => { + if let Some((surface_id, a)) = self.action_to_confirm { + if id == surface_id { + self.action_to_confirm = None; + return Command::batch(vec![ + destroy_layer_surface(id), + match a { + PowerAction::Lock => Command::perform(lock(), Message::Zbus), + PowerAction::LogOut => Command::perform(log_out(), Message::Zbus), + PowerAction::Suspend => Command::perform(suspend(), Message::Zbus), + PowerAction::Restart => Command::perform(restart(), Message::Zbus), + PowerAction::Shutdown => { + Command::perform(shutdown(), Message::Zbus) + } + }, + ]); + } + } + Command::none() + } } } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { - self.applet_helper - .icon_button(&self.icon_name) - .on_press(Message::TogglePopup) - .into() - } else { - let settings = row_button(vec!["Settings...".into()]).on_press(Message::Settings); + if matches!(self.popup, Some(p) if p == id) { + let settings = + row_button(vec![text(fl!("settings")).size(14).into()]).on_press(Message::Settings); let session = column![ row_button(vec![ text_icon("system-lock-screen-symbolic", 24).into(), - "Lock Screen".into(), + text(fl!("lock-screen")).size(14).into(), Space::with_width(Length::Fill).into(), - "Super + Escape".into(), + text(fl!("lock-screen-shortcut")).size(14).into(), ]) - .on_press(Message::Lock), + .on_press(Message::Action(PowerAction::Lock)), row_button(vec![ text_icon("system-log-out-symbolic", 24).into(), - "Log Out".into(), + text(fl!("log-out")).size(14).into(), Space::with_width(Length::Fill).into(), - "Ctrl + Alt + Delete".into(), + text(fl!("log-out-shortcut")).size(14).into(), ]) - .on_press(Message::LogOut), + .on_press(Message::Action(PowerAction::LogOut)), ]; let power = row![ - power_buttons("system-lock-screen-symbolic", "Suspend").on_press(Message::Suspend), - power_buttons("system-restart-symbolic", "Restart").on_press(Message::Restart), - power_buttons("system-shutdown-symbolic", "Shutdown").on_press(Message::Shutdown), + power_buttons("system-lock-screen-symbolic", fl!("suspend")) + .on_press(Message::Action(PowerAction::Suspend)), + power_buttons("system-restart-symbolic", fl!("restart")) + .on_press(Message::Action(PowerAction::Restart)), + power_buttons("system-shutdown-symbolic", fl!("shutdown")) + .on_press(Message::Action(PowerAction::Shutdown)), ] .spacing(24) .padding([0, 24]); @@ -188,6 +283,65 @@ impl Application for Power { .padding([8, 0]); self.applet_helper.popup_container(content).into() + } else if matches!(self.action_to_confirm, Some((c_id, _)) if c_id == id) { + let action = match self.action_to_confirm.as_ref().unwrap().1 { + PowerAction::Lock => "lock-screen", + PowerAction::LogOut => "log-out", + PowerAction::Suspend => "suspend", + PowerAction::Restart => "restart", + PowerAction::Shutdown => "shutdown", + }; + // TODO actual countdown + let content = column![ + text(fl!( + "confirm-question", + HashMap::from_iter(vec![("action", action), ("countdown", "60")]) + )) + .size(16), + row![ + button(theme::Button::Primary) + .custom(vec![text(fl!("confirm")).size(14).into()]) + .on_press(Message::Confirm), + button(theme::Button::Primary) + .custom(vec![text(fl!("cancel")).size(14).into()]) + .on_press(Message::Cancel), + ] + .spacing(24) + ] + .align_items(Alignment::Center) + .spacing(12) + .padding(24); + mouse_area( + container( + container(content) + .style(cosmic::theme::Container::custom(|theme| { + cosmic::iced_style::container::Appearance { + text_color: Some(theme.cosmic().background.on.into()), + background: Some( + Color::from(theme.cosmic().background.base).into(), + ), + border_radius: 12.0.into(), + border_width: 2.0, + border_color: theme.cosmic().bg_divider().into(), + } + })) + .width(Length::Shrink) + .height(Length::Shrink), + ) + .align_x(Horizontal::Center) + .align_y(Vertical::Center) + .width(Length::Fill) + .height(Length::Fill), + ) + .on_press(Message::Cancel) + .on_right_press(Message::Cancel) + .on_middle_press(Message::Cancel) + .into() + } else { + self.applet_helper + .icon_button(&self.icon_name) + .on_press(Message::TogglePopup) + .into() } } } @@ -195,7 +349,7 @@ impl Application for Power { // ### UI Helplers fn row_button(content: Vec>) -> widget::Button { - button(APPLET_BUTTON_THEME) + button(applet_button_theme()) .custom(vec![Row::with_children(content) .spacing(4) .align_items(Alignment::Center) @@ -204,14 +358,14 @@ fn row_button(content: Vec>) -> widget::Button(name: &'a str, text: &'a str) -> widget::Button<'a, Message, Renderer> { +fn power_buttons<'a>(name: &'a str, msg: String) -> widget::Button<'a, Message, Renderer> { widget::button( - column![text_icon(name, 40), text] + column![text_icon(name, 40), text(msg).size(14)] .spacing(4) .align_items(Alignment::Center), ) .width(Length::Fill) - .height(Length::Units(76)) + .height(Length::Fixed(76.0)) .style(theme::Button::Text) } diff --git a/cosmic-applet-time/Cargo.toml b/cosmic-applet-time/Cargo.toml index 30749491..a306b089 100644 --- a/cosmic-applet-time/Cargo.toml +++ b/cosmic-applet-time/Cargo.toml @@ -6,6 +6,7 @@ license = "GPL-3.0-or-later" [dependencies] icon-loader = { version = "0.3.6", features = ["gtk"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } nix = "0.24.1" chrono = { version = "0.4.23", features = ["clock"] } diff --git a/cosmic-applet-time/src/main.rs b/cosmic-applet-time/src/main.rs index 89becccd..33984e5c 100644 --- a/cosmic-applet-time/src/main.rs +++ b/cosmic-applet-time/src/main.rs @@ -1,18 +1,18 @@ -use cosmic::applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper}; use cosmic::iced::wayland::popup::{destroy_popup, get_popup}; +use cosmic::iced::Limits; use cosmic::iced::{ time, wayland::InitialSurface, widget::{button, column, text, vertical_space}, window, Alignment, Application, Color, Command, Length, Rectangle, Subscription, }; -use cosmic::iced_sctk::layout::Limits; use cosmic::iced_style::application::{self, Appearance}; use cosmic::theme; use cosmic::{ widget::{icon, rectangle_tracker::*}, Element, Theme, }; +use cosmic_applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper}; use chrono::{DateTime, Local, Timelike}; use std::time::Duration; @@ -22,10 +22,8 @@ pub fn main() -> cosmic::iced::Result { let mut settings = helper.window_settings(); match &mut settings.initial_surface { InitialSurface::XdgWindow(s) => { - s.iced_settings.min_size = Some((1, 1)); - s.iced_settings.max_size = None; s.autosize = true; - s.size_limits = Limits::NONE.min_height(1).min_width(1); + s.size_limits = Limits::NONE.min_height(1.0).min_width(1.0); } _ => {} }; @@ -36,7 +34,7 @@ struct Time { applet_helper: CosmicAppletHelper, theme: Theme, popup: Option, - id_ctr: u32, + id_ctr: u128, update_at: Every, now: DateTime, msg: String, @@ -90,7 +88,7 @@ impl Application for Time { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -98,10 +96,10 @@ impl Application for Time { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } fn subscription(&self) -> Subscription { @@ -120,7 +118,7 @@ impl Application for Time { .expect("Setting nanoseconds to 0 should always be possible."); let wait = 1.max((next - now).num_milliseconds()); Subscription::batch(vec![ - rectangle_tracker_subscription(0).map(|(_, update)| Message::Rectangle(update)), + rectangle_tracker_subscription(0).map(|e| Message::Rectangle(e.1)), time::every(Duration::from_millis( wait.try_into().unwrap_or(FALLBACK_DELAY), )) @@ -149,11 +147,11 @@ impl Application for Time { .to_string(); self.msg = calendar; self.id_ctr += 1; - let new_id = window::Id::new(self.id_ctr); + let new_id = window::Id(self.id_ctr); self.popup.replace(new_id); let mut popup_settings = self.applet_helper.get_popup_settings( - window::Id::new(0), + window::Id(0), new_id, None, None, @@ -194,13 +192,13 @@ impl Application for Time { } fn view(&self, id: window::Id) -> Element { - if id == window::Id::new(0) { + if id == window::Id(0) { let button = button( if matches!( self.applet_helper.anchor, PanelAnchor::Top | PanelAnchor::Bottom ) { - column![text(self.now.format("%b %-d %-I:%M %p").to_string())] + column![text(self.now.format("%b %-d %-I:%M %p").to_string()).size(14)] } else { let mut date_time_col = column![ icon( @@ -208,10 +206,10 @@ impl Application for Time { self.applet_helper.suggested_size().0 ) .style(theme::Svg::Symbolic), - text(self.now.format("%I").to_string()), - text(self.now.format("%M").to_string()), - text(self.now.format("%p").to_string()), - vertical_space(Length::Units(4)), + text(self.now.format("%I").to_string()).size(14), + text(self.now.format("%M").to_string()).size(14), + text(self.now.format("%p").to_string()).size(14), + vertical_space(Length::Fixed(4.0)), // TODO better calendar icon? icon( "calendar-go-today-symbolic", @@ -222,7 +220,7 @@ impl Application for Time { .align_items(Alignment::Center) .spacing(4); for d in self.now.format("%x").to_string().split("/") { - date_time_col = date_time_col.push(text(d.to_string())); + date_time_col = date_time_col.push(text(d.to_string()).size(14)); } date_time_col }, @@ -240,7 +238,7 @@ impl Application for Time { .align_items(Alignment::Start) .spacing(12) .padding([24, 0]) - .push(text(&self.msg)) + .push(text(&self.msg).size(14)) .padding(8); self.applet_helper.popup_container(content).into() diff --git a/cosmic-applet-workspaces/Cargo.toml b/cosmic-applet-workspaces/Cargo.toml index 452d2c18..8174a35b 100644 --- a/cosmic-applet-workspaces/Cargo.toml +++ b/cosmic-applet-workspaces/Cargo.toml @@ -5,15 +5,16 @@ authors = ["Ashley Wulber "] edition = "2021" [dependencies] -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } -cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false } -cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } +cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, rev = "f0cfe09" } +cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"], rev = "f0cfe09" } wayland-backend = {version = "0.1.0", features = ["client_system"]} wayland-client = {version = "0.30.0"} calloop = "0.10.1" nix = "0.26.1" log = "0.4" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" once_cell = "1.9" futures = "0.3.21" xdg = "2.4.0" diff --git a/cosmic-applet-workspaces/src/components/app.rs b/cosmic-applet-workspaces/src/components/app.rs index 7187e6aa..d819d0ac 100644 --- a/cosmic-applet-workspaces/src/components/app.rs +++ b/cosmic-applet-workspaces/src/components/app.rs @@ -1,19 +1,19 @@ use calloop::channel::SyncSender; -use cosmic::applet::cosmic_panel_config::PanelAnchor; -use cosmic::applet::CosmicAppletHelper; use cosmic::iced::alignment::{Horizontal, Vertical}; use cosmic::iced::mouse::{self, ScrollDelta}; use cosmic::iced::wayland::actions::window::SctkWindowSettings; use cosmic::iced::wayland::{window::resize_window, InitialSurface}; use cosmic::iced::widget::{column, container, row, text}; +use cosmic::iced::Color; use cosmic::iced::{ subscription, widget::button, window, Application, Command, Event::Mouse, Length, Settings, Subscription, }; use cosmic::iced_style::application::{self, Appearance}; -use cosmic::iced_style::Color; use cosmic::theme::Button; use cosmic::{Element, Theme}; +use cosmic_applet::cosmic_panel_config::PanelAnchor; +use cosmic_applet::CosmicAppletHelper; use cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1; use std::cmp::Ordering; use wayland_backend::client::ObjectId; @@ -25,10 +25,7 @@ use crate::wayland_subscription::{workspaces, WorkspacesUpdate}; pub fn run() -> cosmic::iced::Result { let settings = Settings { initial_surface: InitialSurface::XdgWindow(SctkWindowSettings { - iced_settings: cosmic::iced_native::window::Settings { - size: (32, 32), - ..Default::default() - }, + size: (32, 32), ..Default::default() }), ..Default::default() @@ -103,7 +100,7 @@ impl Application for IcedWorkspacesApplet { Layout::Row => (unit * self.workspaces.len().max(1) as u32, unit), Layout::Column => (unit, unit * self.workspaces.len().max(1) as u32), }; - return resize_window(window::Id::new(0), w, h); + return resize_window(window::Id(0), w, h); } WorkspacesUpdate::Started(tx) => { self.workspace_tx.replace(tx); @@ -141,6 +138,7 @@ impl Application for IcedWorkspacesApplet { .filter_map(|w| { let btn = button( text(w.0.clone()) + .size(14) .horizontal_alignment(Horizontal::Center) .vertical_alignment(Vertical::Center) .width(Length::Fill) @@ -184,7 +182,7 @@ impl Application for IcedWorkspacesApplet { fn subscription(&self) -> Subscription { Subscription::batch( vec![ - workspaces(0).map(|(_, msg)| Message::WorkspaceUpdate(msg)), + workspaces(0).map(|e| Message::WorkspaceUpdate(e.1)), subscription::events_with(|e, _| match e { Mouse(mouse::Event::WheelScrolled { delta }) => { Some(Message::WheelScrolled(delta)) @@ -197,7 +195,7 @@ impl Application for IcedWorkspacesApplet { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } fn close_requested(&self, _id: window::Id) -> Self::Message { @@ -205,9 +203,9 @@ impl Application for IcedWorkspacesApplet { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| Appearance { + ::Style::Custom(Box::new(|theme| Appearance { background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0), text_color: theme.cosmic().on_bg_color().into(), - }) + })) } } diff --git a/cosmic-applet-workspaces/src/meson.build b/cosmic-applet-workspaces/src/meson.build deleted file mode 100644 index 2fa8e681..00000000 --- a/cosmic-applet-workspaces/src/meson.build +++ /dev/null @@ -1,53 +0,0 @@ -global_conf = configuration_data() -global_conf.set_quoted('APP_ID', application_id) -global_conf.set_quoted('PROFILE', profile) -global_conf.set_quoted('VERSION', version + version_suffix) -config = configure_file( - input: 'config.rs.in', - output: 'config.rs', - configuration: global_conf -) -# Copy the config.rs output to the source directory. -run_command( - 'cp', - meson.project_build_root() / 'src' / 'config.rs', - meson.project_source_root() / 'src' / 'config.rs', - check: true -) - -cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] -cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ] - -if get_option('profile') == 'default' - cargo_options += [ '--release' ] - rust_target = 'release' - message('Building in release mode') -else - rust_target = 'debug' - message('Building in debug mode') -endif - -if get_option('vendor') == true - cargo_options += [ '--locked' ] - message('Building with vendoring') -endif - -cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] - -cargo_build = custom_target( - 'cargo-build', - build_by_default: true, - build_always_stale: true, - output: meson.project_name(), - console: true, - install: true, - install_dir: bindir, - command: [ - 'env', - cargo_env, - cargo, 'build', - cargo_options, - '&&', - 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@', - ] -) diff --git a/cosmic-applet-workspaces/src/wayland.rs b/cosmic-applet-workspaces/src/wayland.rs index ebb2713a..0bea885d 100644 --- a/cosmic-applet-workspaces/src/wayland.rs +++ b/cosmic-applet-workspaces/src/wayland.rs @@ -1,5 +1,4 @@ use calloop::channel::*; -use cosmic::applet::cosmic_panel_config::CosmicPanelOuput; use cosmic_client_toolkit::{ sctk::{ self, @@ -11,7 +10,7 @@ use cosmic_client_toolkit::{ }; use cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1; use futures::{channel::mpsc, executor::block_on, SinkExt}; -use std::{env, os::unix::net::UnixStream, path::PathBuf, str::FromStr, time::Duration}; +use std::{env, os::unix::net::UnixStream, path::PathBuf, time::Duration}; use wayland_backend::client::ObjectId; use wayland_client::{ globals::registry_queue_init, @@ -45,10 +44,6 @@ pub fn spawn_workspaces(tx: mpsc::Sender) -> SyncSender name, - _ => "".to_string(), - }) .unwrap_or_default(); let mut event_loop = calloop::EventLoop::::try_new().unwrap(); let loop_handle = event_loop.handle(); @@ -97,7 +92,11 @@ pub fn spawn_workspaces(tx: mpsc::Sender) -> SyncSender( subscription::unfold(id, State::Ready, move |state| _workspaces(id, state)) } -async fn _workspaces(id: I, state: State) -> (Option<(I, WorkspacesUpdate)>, State) { - match state { - State::Ready => { - if let Ok(watcher) = WorkspacesWatcher::new() { - ( - Some((id, WorkspacesUpdate::Started(watcher.get_sender()))), - State::Waiting(watcher), - ) - } else { - (Some((id, WorkspacesUpdate::Errored)), State::Error) +async fn _workspaces(id: I, mut state: State) -> ((I, WorkspacesUpdate), State) { + loop { + let (update, new_state) = match state { + State::Ready => { + if let Ok(watcher) = WorkspacesWatcher::new() { + ( + Some((id, WorkspacesUpdate::Started(watcher.get_sender()))), + State::Waiting(watcher), + ) + } else { + (Some((id, WorkspacesUpdate::Errored)), State::Error) + } } - } - State::Waiting(mut t) => { - if let Some(w) = t.workspaces().await { - ( - Some((id, WorkspacesUpdate::Workspaces(w))), - State::Waiting(t), - ) - } else { - (Some((id, WorkspacesUpdate::Errored)), State::Error) + State::Waiting(mut t) => { + if let Some(w) = t.workspaces().await { + ( + Some((id, WorkspacesUpdate::Workspaces(w))), + State::Waiting(t), + ) + } else { + (Some((id, WorkspacesUpdate::Errored)), State::Error) + } } + State::Error => cosmic::iced::futures::future::pending().await, + }; + state = new_state; + + if let Some(update) = update { + return (update, state); } - State::Error => cosmic::iced::futures::future::pending().await, } } diff --git a/cosmic-panel-button/Cargo.toml b/cosmic-panel-button/Cargo.toml index 3095b77c..d59435a4 100644 --- a/cosmic-panel-button/Cargo.toml +++ b/cosmic-panel-button/Cargo.toml @@ -6,4 +6,5 @@ license = "GPL-3.0-or-later" [dependencies] freedesktop-desktop-entry = "0.5.0" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +cosmic-applet = { path = "../applet" } diff --git a/cosmic-panel-button/src/main.rs b/cosmic-panel-button/src/main.rs index 204971f9..6a2da55e 100644 --- a/cosmic-panel-button/src/main.rs +++ b/cosmic-panel-button/src/main.rs @@ -1,14 +1,10 @@ use cosmic::{ - applet::CosmicAppletHelper, - iced::{ - self, - wayland::InitialSurface, - Application, - }, - iced_sctk::layout::Limits, + iced::Limits, + iced::{self, wayland::InitialSurface, Application}, + iced_runtime::core::window, iced_style::application, - iced_native::window, }; +use cosmic_applet::CosmicAppletHelper; use freedesktop_desktop_entry::DesktopEntry; use std::{env, fs, process::Command}; @@ -47,10 +43,12 @@ impl iced::Application for Button { } fn style(&self) -> ::Style { - ::Style::Custom(|theme| application::Appearance { - background_color: iced::Color::from_rgba(0.0, 0.0, 0.0, 0.0), - text_color: theme.cosmic().on_bg_color().into(), - }) + ::Style::Custom(Box::new(|theme| { + application::Appearance { + background_color: iced::Color::from_rgba(0.0, 0.0, 0.0, 0.0), + text_color: theme.cosmic().on_bg_color().into(), + } + })) } fn subscription(&self) -> iced::Subscription { @@ -112,10 +110,8 @@ pub fn main() -> iced::Result { }; match &mut settings.initial_surface { InitialSurface::XdgWindow(s) => { - s.iced_settings.min_size = Some((1, 1)); - s.iced_settings.max_size = None; s.autosize = true; - s.size_limits = Limits::NONE.min_height(1).min_width(1); + s.size_limits = Limits::NONE.min_height(1.0).min_width(1.0); } _ => unreachable!(), };