From 3ec06bef800afc45d1da5a54413684da3f95e369 Mon Sep 17 00:00:00 2001 From: Brock <58987761+13r0ck@users.noreply.github.com> Date: Wed, 7 Jun 2023 13:43:49 -0600 Subject: [PATCH] Init Animations: animate toggler widgets (#96) --- Cargo.lock | 167 ++++++++++-------- Cargo.toml | 2 + applet/Cargo.toml | 4 +- applet/src/lib.rs | 13 +- cosmic-app-list/Cargo.toml | 2 +- cosmic-applet-audio/Cargo.toml | 4 +- cosmic-applet-audio/src/localize.rs | 2 +- cosmic-applet-audio/src/main.rs | 35 ++-- cosmic-applet-battery/Cargo.toml | 3 +- cosmic-applet-battery/src/app.rs | 30 +++- cosmic-applet-bluetooth/Cargo.toml | 2 +- cosmic-applet-graphics/Cargo.toml | 2 +- cosmic-applet-network/Cargo.toml | 4 +- cosmic-applet-network/src/app.rs | 74 ++++++-- cosmic-applet-network/src/localize.rs | 2 +- .../src/network_manager/devices.rs | 7 +- .../src/network_manager/mod.rs | 5 +- cosmic-applet-notifications/Cargo.toml | 3 +- cosmic-applet-notifications/src/main.rs | 35 ++-- cosmic-applet-power/Cargo.toml | 2 +- cosmic-applet-time/Cargo.toml | 2 +- cosmic-applet-workspaces/Cargo.toml | 2 +- cosmic-panel-button/Cargo.toml | 2 +- 23 files changed, 251 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a8b9831..7f057d12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -493,10 +493,11 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "calloop" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a59225be45a478d772ce015d9743e49e92798ece9e34eda9a6aa2a6a7f40192" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" dependencies = [ + "bitflags 1.3.2", "log", "nix 0.25.1", "slotmap", @@ -512,9 +513,9 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-expr" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9" +checksum = "e70d3ad08698a0568b0562f22710fe6bfc1f4a61a367c77d0398c562eadd453a" dependencies = [ "smallvec", "target-lexicon", @@ -703,6 +704,7 @@ name = "cosmic-applet-audio" version = "0.1.0" dependencies = [ "cosmic-applet", + "cosmic-time", "i18n-embed", "i18n-embed-fl", "icon-loader", @@ -710,7 +712,6 @@ dependencies = [ "libpulse-binding", "libpulse-glib-binding", "log", - "once_cell", "pretty_env_logger 0.4.0", "rust-embed", "rust-embed-utils", @@ -722,6 +723,7 @@ name = "cosmic-applet-battery" version = "0.1.0" dependencies = [ "cosmic-applet", + "cosmic-time", "futures", "i18n-embed", "i18n-embed-fl", @@ -776,6 +778,7 @@ dependencies = [ "anyhow", "cosmic-applet", "cosmic-dbus-networkmanager", + "cosmic-time", "futures", "futures-util", "i18n-embed", @@ -783,7 +786,6 @@ dependencies = [ "itertools", "libcosmic", "log", - "once_cell", "pretty_env_logger 0.5.0", "rust-embed", "rust-embed-utils", @@ -797,6 +799,7 @@ name = "cosmic-applet-notifications" version = "0.1.0" dependencies = [ "cosmic-applet", + "cosmic-time", "icon-loader", "libcosmic", "nix 0.24.3", @@ -869,7 +872,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -883,7 +886,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "quote", "syn 1.0.109", @@ -914,7 +917,7 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel?rev=11cfff0#11cfff080cf22fc2073fe42feca82afc88eef16e" +source = "git+https://github.com/pop-os/cosmic-panel?rev=6cef482#6cef482fac0670b77646cbbd57227307abe3c52b" dependencies = [ "anyhow", "cosmic-config", @@ -960,7 +963,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "anyhow", "cosmic-config", @@ -972,6 +975,15 @@ dependencies = [ "serde", ] +[[package]] +name = "cosmic-time" +version = "0.2.0" +source = "git+https://github.com/pop-os/cosmic-time?rev=e6ff6d5#e6ff6d5f8992a5d7071b3211baf19a74df73f5c0" +dependencies = [ + "libcosmic", + "once_cell", +] + [[package]] name = "cpufeatures" version = "0.2.7" @@ -1176,7 +1188,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -1354,11 +1366,11 @@ dependencies = [ [[package]] name = "dlib" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.7.4", + "libloading 0.8.0", ] [[package]] @@ -1517,15 +1529,15 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "exr" -version = "1.6.3" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd2162b720141a91a054640662d3edce3d50a944a50ffca5313cd951abb35b4" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" dependencies = [ "bit_field", "flume", "half", "lebe", - "miniz_oxide 0.6.2", + "miniz_oxide 0.7.1", "rayon-core", "smallvec", "zune-inflate", @@ -1691,9 +1703,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1870,9 +1882,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1925,9 +1937,9 @@ checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815" [[package]] name = "glib" -version = "0.17.9" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f1de7cbde31ea4f0a919453a2dcece5d54d5b70e08f8ad254dc4840f5f09b6" +checksum = "d3fad45ba8d4d2cea612b432717e834f48031cd8853c8aaf43b2c79fec8d144b" dependencies = [ "bitflags 1.3.2", "futures-channel", @@ -1947,9 +1959,9 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.17.9" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a7206c5c03851ef126ea1444990e81fdd6765fb799d5bc694e4897ca01bb97f" +checksum = "eca5c79337338391f1ab8058d6698125034ce8ef31b72a442437fa6c8580de26" dependencies = [ "anyhow", "heck", @@ -1962,9 +1974,9 @@ dependencies = [ [[package]] name = "glib-sys" -version = "0.17.4" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f00ad0a1bf548e61adfff15d83430941d9e1bb620e334f779edd1c745680a5" +checksum = "d80aa6ea7bba0baac79222204aa786a6293078c210abe69ef1336911d4bdc4f0" dependencies = [ "libc", "system-deps", @@ -1972,9 +1984,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e007a07a24de5ecae94160f141029e9a347282cfe25d1d58d85d845cf3130f1" +checksum = "807edf58b70c0b5b2181dd39fe1839dbdb3ba02645630dc5f753e23da307f762" dependencies = [ "js-sys", "slotmap", @@ -1995,9 +2007,9 @@ dependencies = [ [[package]] name = "gobject-sys" -version = "0.17.4" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e75b0000a64632b2d8ca3cf856af9308e3a970844f6e9659bd197f026793d0" +checksum = "cd34c3317740a6358ec04572c1bcfd3ac0b5b6529275fae255b237b314bb8062" dependencies = [ "glib-sys", "libc", @@ -2246,9 +2258,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2270,7 +2282,7 @@ dependencies = [ [[package]] name = "iced" version = "0.9.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "iced_accessibility", "iced_core", @@ -2285,7 +2297,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "accesskit", "accesskit_unix", @@ -2294,7 +2306,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.9.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "bitflags 1.3.2", "iced_accessibility", @@ -2309,7 +2321,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.6.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "futures", "iced_core", @@ -2322,7 +2334,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.8.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2339,7 +2351,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2351,7 +2363,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "iced_accessibility", "iced_core", @@ -2363,7 +2375,7 @@ dependencies = [ [[package]] name = "iced_sctk" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "enum-repr", "float-cmp", @@ -2384,7 +2396,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.8.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "iced_core", "once_cell", @@ -2394,7 +2406,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "bytemuck", "cosmic-text", @@ -2412,7 +2424,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.10.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -2434,7 +2446,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "iced_renderer", "iced_runtime", @@ -2465,9 +2477,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2675,14 +2687,14 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=31f7e97#31f7e97d5bf4860be5afd406209eed733f736f04" +source = "git+https://github.com/pop-os/libcosmic/?rev=5765053#5765053ad70d7b0fded56fe9e9c73649509a03ae" dependencies = [ "apply", "cosmic-config", @@ -2692,6 +2704,8 @@ dependencies = [ "freedesktop-icons", "iced", "iced_core", + "iced_futures", + "iced_renderer", "iced_runtime", "iced_sctk", "iced_style", @@ -2815,9 +2829,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -3196,18 +3210,18 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "option-ext" @@ -3331,7 +3345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -3350,22 +3364,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.0", ] [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "phf" @@ -3710,9 +3724,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -4338,15 +4352,16 @@ checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix 0.37.19", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -4725,9 +4740,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -5171,9 +5186,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41af2ea7d87bd41ad0a37146252d5f7c26490209f47f544b2ee3b3ff34c7732e" +checksum = "74851c2c8e5d97652e74c241d41b0656b31c924a45dcdecde83975717362cfa4" dependencies = [ "android_system_properties", "arrayvec", @@ -5527,9 +5542,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d8f380ae16a37b30e6a2cf67040608071384b1450c189e61bea3ff57cde922d" +checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c" [[package]] name = "xmlparser" diff --git a/Cargo.toml b/Cargo.toml index 5049bf15..52e7b8cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,8 @@ members = [ "cosmic-panel-button", ] +resolver="2" + [profile.release] lto = "thin" # lto = "fat" diff --git a/applet/Cargo.toml b/applet/Cargo.toml index 96605472..9666fbf9 100644 --- a/applet/Cargo.toml +++ b/applet/Cargo.toml @@ -6,7 +6,7 @@ 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"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } ron = { version = "0.8" } serde = { version = "1.0" } -cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", rev = "11cfff0" } +cosmic-panel-config = { git = "https://github.com/pop-os/cosmic-panel", rev = "6cef482" } diff --git a/applet/src/lib.rs b/applet/src/lib.rs index af6592bb..2b4d6a80 100644 --- a/applet/src/lib.rs +++ b/applet/src/lib.rs @@ -1,16 +1,15 @@ use cosmic::{ - iced::{self, window, Limits}, + iced::{ + alignment::{Horizontal, Vertical}, + wayland::InitialSurface, + widget::{self, Container}, + window, Limits, Color, Element, Length, Rectangle, Settings, + }, 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}, diff --git a/cosmic-app-list/Cargo.toml b/cosmic-app-list/Cargo.toml index d78d4f02..7b8ce478 100644 --- a/cosmic-app-list/Cargo.toml +++ b/cosmic-app-list/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] 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"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["wayland", "tokio"] } cosmic-applet = { path = "../applet" } # libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio"] } ron = "0.8" diff --git a/cosmic-applet-audio/Cargo.toml b/cosmic-applet-audio/Cargo.toml index bb03ccfb..7d870dc7 100644 --- a/cosmic-applet-audio/Cargo.toml +++ b/cosmic-applet-audio/Cargo.toml @@ -10,7 +10,8 @@ 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/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } +cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev = "e6ff6d5", default-features = false, features = ["libcosmic", "once_cell"] } cosmic-applet = { path = "../applet" } log = "0.4.14" pretty_env_logger = "0.4.0" @@ -19,5 +20,4 @@ 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/src/localize.rs b/cosmic-applet-audio/src/localize.rs index baa05d0d..c26b28ec 100644 --- a/cosmic-applet-audio/src/localize.rs +++ b/cosmic-applet-audio/src/localize.rs @@ -4,7 +4,7 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; +use cosmic_time::once_cell::sync::Lazy; use rust_embed::RustEmbed; #[derive(RustEmbed)] diff --git a/cosmic-applet-audio/src/main.rs b/cosmic-applet-audio/src/main.rs index a40aabd2..ed94dc0b 100644 --- a/cosmic-applet-audio/src/main.rs +++ b/cosmic-applet-audio/src/main.rs @@ -11,11 +11,15 @@ use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; use cosmic::iced::{ self, - widget::{column, row, slider, text, toggler}, + widget::{column, row, slider, text}, window, Alignment, Application, Command, Length, Subscription, }; use cosmic::iced_style::application::{self, Appearance}; use cosmic::{Element, Theme}; +use cosmic_time::{ + once_cell::sync::Lazy, + anim, chain, id, Timeline, Instant, +}; use iced::wayland::popup::{destroy_popup, get_popup}; use iced::widget::container; @@ -36,6 +40,8 @@ pub fn main() -> cosmic::iced::Result { Audio::run(helper.window_settings()) } +static SHOW_MEDIA_CONTROLS: Lazy = Lazy::new(id::Toggler::unique); + #[derive(Default)] struct Audio { is_open: IsOpen, @@ -50,6 +56,7 @@ struct Audio { popup: Option, show_media_controls_in_top_panel: bool, id_ctr: u128, + timeline: Timeline, } #[derive(Debug, PartialEq, Eq)] @@ -70,7 +77,8 @@ enum Message { Pulse(pulse::Event), Ignore, TogglePopup, - ToggleMediaControlsInTopPanel(bool), + ToggleMediaControlsInTopPanel(chain::Toggler, bool), + Frame(Instant), } impl Application for Audio { @@ -115,6 +123,9 @@ impl Application for Audio { fn update(&mut self, message: Message) -> Command { match message { + Message::Frame(now) => { + self.timeline.now(now) + }, Message::TogglePopup => { if let Some(p) = self.popup.take() { return destroy_popup(p); @@ -261,7 +272,8 @@ impl Application for Audio { pulse::Event::Disconnected => self.pulse_state.disconnected(), }, Message::Ignore => {} - Message::ToggleMediaControlsInTopPanel(enabled) => { + Message::ToggleMediaControlsInTopPanel(chain, enabled) => { + self.timeline.set_chain(chain).start(); self.show_media_controls_in_top_panel = enabled; } }; @@ -270,7 +282,9 @@ impl Application for Audio { } fn subscription(&self) -> Subscription { - pulse::connect().map(Message::Pulse) + Subscription::batch(vec![pulse::connect().map(Message::Pulse), + self.timeline.as_subscription().map(Message::Frame), + ]) } fn view(&self, id: window::Id) -> Element { @@ -375,12 +389,13 @@ impl Application for Audio { .padding([12, 24]) .width(Length::Fill), container( - toggler( - Some(fl!("show-media-controls")), - self.show_media_controls_in_top_panel, - Message::ToggleMediaControlsInTopPanel, - ) - .text_size(14) + anim!( // toggler + SHOW_MEDIA_CONTROLS, + &self.timeline, + Some(fl!("show-media-controls")), + self.show_media_controls_in_top_panel, + Message::ToggleMediaControlsInTopPanel, + ).text_size(14) ) .padding([0, 24]), container(divider::horizontal::light()) diff --git a/cosmic-applet-battery/Cargo.toml b/cosmic-applet-battery/Cargo.toml index 9de9b42d..bee25020 100644 --- a/cosmic-applet-battery/Cargo.toml +++ b/cosmic-applet-battery/Cargo.toml @@ -5,7 +5,8 @@ edition = "2021" [dependencies] once_cell = "1.16.0" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } +cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev = "e6ff6d5", default-features = false, features = ["libcosmic", "once_cell"] } cosmic-applet = { path = "../applet" } futures = "0.3" zbus = { version = "3.13", default-features = false, features = ["tokio"] } diff --git a/cosmic-applet-battery/src/app.rs b/cosmic-applet-battery/src/app.rs index cdf905ab..55bf46b8 100644 --- a/cosmic-applet-battery/src/app.rs +++ b/cosmic-applet-battery/src/app.rs @@ -20,9 +20,14 @@ use cosmic::iced::{ use cosmic::iced_runtime::core::layout::Limits; use cosmic::iced_style::application::{self, Appearance}; use cosmic::theme::Svg; -use cosmic::widget::{button, divider, icon, toggler}; +use cosmic::widget::{button, divider, icon}; use cosmic::{Element, Theme}; use cosmic_applet::{applet_button_theme, CosmicAppletHelper}; +use cosmic_time::{ + once_cell::sync::Lazy, + anim, chain, id, Timeline, Instant, +}; + use log::error; use std::time::Duration; use tokio::sync::mpsc::UnboundedSender; @@ -48,6 +53,8 @@ pub fn run() -> cosmic::iced::Result { CosmicBatteryApplet::run(helper.window_settings()) } +static MAX_CHARGE: Lazy = Lazy::new(id::Toggler::unique); + #[derive(Clone, Default)] struct CosmicBatteryApplet { icon_name: String, @@ -64,6 +71,7 @@ struct CosmicBatteryApplet { applet_helper: CosmicAppletHelper, power_profile: Power, power_profile_sender: Option>, + timeline: Timeline, } #[derive(Debug, Clone)] @@ -76,7 +84,7 @@ enum Message { }, SetKbdBrightness(i32), SetScreenBrightness(i32), - SetChargingLimit(bool), + SetChargingLimit(chain::Toggler, bool), UpdateKbdBrightness(f64), UpdateScreenBrightness(f64), OpenBatterySettings, @@ -87,6 +95,7 @@ enum Message { InitProfile(UnboundedSender, Power), Profile(Power), SelectProfile(Power), + Frame(Instant), } impl Application for CosmicBatteryApplet { @@ -111,6 +120,7 @@ impl Application for CosmicBatteryApplet { fn update(&mut self, message: Message) -> Command { match message { + Message::Frame(now) => self.timeline.now(now), Message::SetKbdBrightness(brightness) => { self.kbd_brightness = (brightness as f64 / 100.0).clamp(0., 1.); if let Some(tx) = &self.kbd_sender { @@ -123,8 +133,9 @@ impl Application for CosmicBatteryApplet { let _ = tx.send(ScreenBacklightRequest::Set(self.screen_brightness)); } } - Message::SetChargingLimit(enable_charging_limit) => { - self.charging_limit = enable_charging_limit; + Message::SetChargingLimit(chain, enable) => { + self.timeline.set_chain(chain).start(); + self.charging_limit = enable; } Message::OpenBatterySettings => { // TODO Ashley @@ -309,9 +320,13 @@ impl Application for CosmicBatteryApplet { .width(Length::Fill) .padding([0, 12]), container( - toggler(fl!("max-charge"), self.charging_limit, |_| { - Message::SetChargingLimit(!self.charging_limit) - }) + anim!( //toggler + MAX_CHARGE, + &self.timeline, + fl!("max-charge"), + self.charging_limit, + Message::SetChargingLimit, + ) .text_size(14) .width(Length::Fill) ) @@ -396,6 +411,7 @@ impl Application for CosmicBatteryApplet { (_, PowerProfileUpdate::Init(tx, p)) => Message::InitProfile(p, tx), (_, PowerProfileUpdate::Error(e)) => Message::Errored(e), // TODO: handle error }), + self.timeline.as_subscription().map(Message::Frame), ]) } diff --git a/cosmic-applet-bluetooth/Cargo.toml b/cosmic-applet-bluetooth/Cargo.toml index 55701a53..3fd4456c 100644 --- a/cosmic-applet-bluetooth/Cargo.toml +++ b/cosmic-applet-bluetooth/Cargo.toml @@ -8,7 +8,7 @@ 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/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["wayland", "tokio"] } cosmic-applet = { path = "../applet" } futures = "0.3" log = "0.4" diff --git a/cosmic-applet-graphics/Cargo.toml b/cosmic-applet-graphics/Cargo.toml index 7b35533b..f86e53ec 100644 --- a/cosmic-applet-graphics/Cargo.toml +++ b/cosmic-applet-graphics/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] zbus = "3.13" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } cosmic-applet = { path = "../applet" } once_cell = "1" # Application i18n diff --git a/cosmic-applet-network/Cargo.toml b/cosmic-applet-network/Cargo.toml index 214c1c69..83e7f81e 100644 --- a/cosmic-applet-network/Cargo.toml +++ b/cosmic-applet-network/Cargo.toml @@ -5,11 +5,11 @@ edition = "2021" license = "GPL-3.0-or-later" [dependencies] -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/", rev = "31f7e97", default-features = false, features = ["wayland", "tokio"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } +cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev = "e6ff6d5", default-features = false, features = ["libcosmic", "once_cell"] } cosmic-applet = { path = "../applet" } futures = "0.3" zbus = { version = "3.13", default-features = false } diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index 8b7986db..8a26ffd8 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -13,11 +13,13 @@ use cosmic::{ }, iced_style::{application, button::StyleSheet}, theme::{Button, Svg}, - widget::{button, divider, icon, toggler}, + widget::{button, divider, icon}, Element, Theme, }; use cosmic_applet::CosmicAppletHelper; use cosmic_dbus_networkmanager::interface::enums::{ActiveConnectionState, DeviceState}; +use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; + use futures::channel::mpsc::UnboundedSender; use zbus::Connection; @@ -76,6 +78,9 @@ impl Into for NewConnectionState { } } +static WIFI: Lazy = Lazy::new(id::Toggler::unique); +static AIRPLANE_MODE: Lazy = Lazy::new(id::Toggler::unique); + #[derive(Default)] struct CosmicNetworkApplet { icon_name: String, @@ -89,6 +94,7 @@ struct CosmicNetworkApplet { show_visible_networks: bool, new_connection: Option, conn: Option, + timeline: Timeline, } impl CosmicNetworkApplet { @@ -112,6 +118,29 @@ impl CosmicNetworkApplet { }) .to_string() } + + fn update_togglers(&mut self, state: &NetworkManagerState) { + let timeline = &mut self.timeline; + if state.wifi_enabled != self.nm_state.wifi_enabled { + let chain = if state.wifi_enabled { + chain::Toggler::on(WIFI.clone(), 1.) + } else { + chain::Toggler::off(WIFI.clone(), 1.) + }; + timeline.set_chain(chain); + }; + + if state.airplane_mode != self.nm_state.airplane_mode { + let chain = if state.airplane_mode { + chain::Toggler::on(AIRPLANE_MODE.clone(), 1.) + } else { + chain::Toggler::off(AIRPLANE_MODE.clone(), 1.) + }; + timeline.set_chain(chain); + }; + + timeline.start(); + } } #[derive(Debug, Clone)] @@ -122,13 +151,14 @@ pub(crate) enum Message { ToggleAirplaneMode(bool), ToggleWiFi(bool), ToggleVisibleNetworks, - Errored(String), Ignore, NetworkManagerEvent(NetworkManagerEvent), SelectWirelessAccessPoint(AccessPoint), CancelNewConnection, Password(String), SubmitPassword, + Frame(Instant), + // Errored(String), } impl Application for CosmicNetworkApplet { @@ -153,6 +183,7 @@ impl Application for CosmicNetworkApplet { fn update(&mut self, message: Message) -> Command { match message { + Message::Frame(now) => self.timeline.now(now), Message::TogglePopup => { if let Some(p) = self.popup.take() { self.show_visible_networks = false; @@ -179,20 +210,14 @@ impl Application for CosmicNetworkApplet { return get_popup(popup_settings); } } - Message::Errored(_) => todo!(), + // Message::Errored(_) => todo!(), Message::Ignore => {} Message::ToggleAirplaneMode(enabled) => { - self.nm_state.airplane_mode = enabled; if let Some(tx) = self.nm_sender.as_mut() { let _ = tx.unbounded_send(NetworkManagerRequest::SetAirplaneMode(enabled)); } } Message::ToggleWiFi(enabled) => { - if !enabled { - self.nm_state.clear(); - } - self.nm_state.wifi_enabled = enabled; - if let Some(tx) = self.nm_sender.as_mut() { let _ = tx.unbounded_send(NetworkManagerRequest::SetWiFi(enabled)); } @@ -204,6 +229,7 @@ impl Application for CosmicNetworkApplet { state, } => { self.nm_sender.replace(sender); + self.update_togglers(&state); self.nm_state = state; self.update_icon_name(); self.conn = Some(conn); @@ -236,7 +262,9 @@ impl Application for CosmicNetworkApplet { self.new_connection.take(); } } - _ => {} + _ => { + self.update_togglers(&state); + } } } else { match req { @@ -500,18 +528,28 @@ impl Application for CosmicNetworkApplet { let mut content = column![ vpn_ethernet_col, container( - toggler(fl!("airplane-mode"), self.nm_state.airplane_mode, |m| { - Message::ToggleAirplaneMode(m) - }) + anim!( + //toggler + AIRPLANE_MODE, + &self.timeline, + fl!("airplane-mode"), + self.nm_state.airplane_mode, + |_chain, enable| { Message::ToggleAirplaneMode(enable) }, + ) .text_size(14) .width(Length::Fill) ) .padding([0, 12]), divider::horizontal::light(), container( - toggler(fl!("wifi"), self.nm_state.wifi_enabled, |m| { - Message::ToggleWiFi(m) - }) + anim!( + //toggler + WIFI, + &self.timeline, + fl!("wifi"), + self.nm_state.wifi_enabled, + |_chain, enable| { Message::ToggleWiFi(enable) }, + ) .text_size(14) .width(Length::Fill) ) @@ -683,9 +721,11 @@ impl Application for CosmicNetworkApplet { fn subscription(&self) -> Subscription { let network_sub = network_manager_subscription(0).map(|e| Message::NetworkManagerEvent(e.1)); + let timeline = self.timeline.as_subscription().map(Message::Frame); if let Some(conn) = self.conn.as_ref() { Subscription::batch(vec![ + timeline, network_sub, active_conns_subscription(0, conn.clone()) .map(|e| Message::NetworkManagerEvent(e.1)), @@ -694,7 +734,7 @@ impl Application for CosmicNetworkApplet { .map(|e| Message::NetworkManagerEvent(e.1)), ]) } else { - network_sub + Subscription::batch(vec![timeline, network_sub]) } } diff --git a/cosmic-applet-network/src/localize.rs b/cosmic-applet-network/src/localize.rs index baa05d0d..8f87ca3e 100644 --- a/cosmic-applet-network/src/localize.rs +++ b/cosmic-applet-network/src/localize.rs @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0-only +use cosmic_time::once_cell::sync::Lazy; use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; #[derive(RustEmbed)] diff --git a/cosmic-applet-network/src/network_manager/devices.rs b/cosmic-applet-network/src/network_manager/devices.rs index e1365a96..c19fefda 100644 --- a/cosmic-applet-network/src/network_manager/devices.rs +++ b/cosmic-applet-network/src/network_manager/devices.rs @@ -1,11 +1,11 @@ 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; -use futures::StreamExt; pub fn devices_subscription( id: I, @@ -50,10 +50,7 @@ async fn start_listening( let new_state = NetworkManagerState::new(&conn).await.unwrap_or_default(); ( - Some(( - id, - NetworkManagerEvent::WirelessAccessPoints(new_state), - )), + 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 5f87ef3f..4e9fbf84 100644 --- a/cosmic-applet-network/src/network_manager/mod.rs +++ b/cosmic-applet-network/src/network_manager/mod.rs @@ -15,7 +15,7 @@ use cosmic_dbus_networkmanager::{ }; use futures::{ channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, - FutureExt, StreamExt, + StreamExt, }; use tokio::{process::Command, time::timeout}; use zbus::{ @@ -141,7 +141,7 @@ async fn start_listening( Some(NetworkManagerRequest::SetWiFi(enabled)) => { let success = network_manager.set_wireless_enabled(enabled).await.is_ok(); let response = NetworkManagerEvent::RequestResponse { - req: NetworkManagerRequest::SetAirplaneMode(enabled), + req: NetworkManagerRequest::SetWiFi(enabled), success, state: NetworkManagerState::new(&conn).await.unwrap_or_default(), }; @@ -624,6 +624,7 @@ impl NetworkManagerState { Ok(_self) } + #[allow(dead_code)] pub fn clear(&mut self) { self.active_conns = Vec::new(); self.known_access_points = Vec::new(); diff --git a/cosmic-applet-notifications/Cargo.toml b/cosmic-applet-notifications/Cargo.toml index 19d8e2cf..701a4b44 100644 --- a/cosmic-applet-notifications/Cargo.toml +++ b/cosmic-applet-notifications/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/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } +cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev = "e6ff6d5", default-features = false, features = ["libcosmic", "once_cell"] } 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 a1942e68..dabc637e 100644 --- a/cosmic-applet-notifications/src/main.rs +++ b/cosmic-applet-notifications/src/main.rs @@ -9,9 +9,10 @@ use cosmic::iced_style::application::{self, Appearance}; use cosmic::iced_widget::Button; use cosmic::theme::Svg; -use cosmic::widget::{divider, icon, toggler}; +use cosmic::widget::{divider, icon}; use cosmic::Renderer; use cosmic::{Element, Theme}; +use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; use std::process; @@ -20,6 +21,8 @@ pub fn main() -> cosmic::iced::Result { Notifications::run(helper.window_settings()) } +static DO_NOT_DISTURB: Lazy = Lazy::new(id::Toggler::unique); + #[derive(Default)] struct Notifications { applet_helper: CosmicAppletHelper, @@ -29,14 +32,16 @@ struct Notifications { id_ctr: u128, do_not_disturb: bool, notifications: Vec>, + timeline: Timeline, } #[derive(Debug, Clone)] enum Message { TogglePopup, - DoNotDisturb(bool), + DoNotDisturb(chain::Toggler, bool), Settings, Ignore, + Frame(Instant), } impl Application for Notifications { @@ -75,11 +80,15 @@ impl Application for Notifications { } fn subscription(&self) -> Subscription { - Subscription::none() + self.timeline.as_subscription().map(Message::Frame) } fn update(&mut self, message: Message) -> Command { match message { + Message::Frame(now) => { + self.timeline.now(now); + Command::none() + } Message::TogglePopup => { if let Some(p) = self.popup.take() { destroy_popup(p) @@ -98,7 +107,8 @@ impl Application for Notifications { get_popup(popup_settings) } } - Message::DoNotDisturb(b) => { + Message::DoNotDisturb(chain, b) => { + self.timeline.set_chain(chain).start(); self.do_not_disturb = b; Command::none() } @@ -117,14 +127,15 @@ impl Application for Notifications { .on_press(Message::TogglePopup) .into() } else { - let do_not_disturb = - row![ - toggler(String::from("Do Not Disturb"), self.do_not_disturb, |b| { - Message::DoNotDisturb(b) - }) - .width(Length::Fill) - ] - .padding([0, 24]); + let do_not_disturb = row![anim!( + DO_NOT_DISTURB, + &self.timeline, + String::from("Do Not Disturb"), + self.do_not_disturb, + Message::DoNotDisturb + ) + .width(Length::Fill)] + .padding([0, 24]); let settings = row_button(vec!["Notification Settings...".into()]).on_press(Message::Settings); diff --git a/cosmic-applet-power/Cargo.toml b/cosmic-applet-power/Cargo.toml index cd6b41ed..d4b8e831 100644 --- a/cosmic-applet-power/Cargo.toml +++ b/cosmic-applet-power/Cargo.toml @@ -9,7 +9,7 @@ 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/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } cosmic-applet = { path = "../applet" } nix = "0.26.2" zbus = "3.13" diff --git a/cosmic-applet-time/Cargo.toml b/cosmic-applet-time/Cargo.toml index a306b089..d7950c4f 100644 --- a/cosmic-applet-time/Cargo.toml +++ b/cosmic-applet-time/Cargo.toml @@ -6,7 +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/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", 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-workspaces/Cargo.toml b/cosmic-applet-workspaces/Cargo.toml index 8174a35b..133665e8 100644 --- a/cosmic-applet-workspaces/Cargo.toml +++ b/cosmic-applet-workspaces/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Ashley Wulber "] edition = "2021" [dependencies] -libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", 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" } diff --git a/cosmic-panel-button/Cargo.toml b/cosmic-panel-button/Cargo.toml index d59435a4..d76ab004 100644 --- a/cosmic-panel-button/Cargo.toml +++ b/cosmic-panel-button/Cargo.toml @@ -6,5 +6,5 @@ license = "GPL-3.0-or-later" [dependencies] freedesktop-desktop-entry = "0.5.0" -libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "31f7e97", default-features = false, features = ["tokio", "wayland"] } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "5765053", default-features = false, features = ["tokio", "wayland"] } cosmic-applet = { path = "../applet" }