diff --git a/Cargo.lock b/Cargo.lock index d7cba3cf..c92ae741 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,33 +20,84 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.12.2" -source = "git+https://github.com/wash2/accesskit.git?branch=winit-0.29#26f729169cd849970af02be62289606c63572d2d" +version = "0.16.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" + +[[package]] +name = "accesskit_atspi_common" +version = "0.9.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "serde", + "thiserror", + "zvariant 3.15.2", +] [[package]] name = "accesskit_consumer" +version = "0.24.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" +dependencies = [ + "accesskit", + "immutable-chunkmap", +] + +[[package]] +name = "accesskit_macos" version = "0.17.0" -source = "git+https://github.com/wash2/accesskit.git?branch=winit-0.29#26f729169cd849970af02be62289606c63572d2d" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" dependencies = [ "accesskit", + "accesskit_consumer", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "once_cell", ] [[package]] name = "accesskit_unix" -version = "0.7.1" -source = "git+https://github.com/wash2/accesskit.git?branch=winit-0.29#26f729169cd849970af02be62289606c63572d2d" +version = "0.12.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" dependencies = [ "accesskit", - "accesskit_consumer", + "accesskit_atspi_common", "atspi", "futures-lite 1.13.0", - "once_cell", "serde", "tokio", "tokio-stream", "zbus 3.15.2", ] +[[package]] +name = "accesskit_windows" +version = "0.22.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" +dependencies = [ + "accesskit", + "accesskit_consumer", + "paste", + "static_assertions", + "windows 0.54.0", +] + +[[package]] +name = "accesskit_winit" +version = "0.22.0" +source = "git+https://github.com/wash2/accesskit?tag=iced-xdg-surface-0.13#956955342dadab7e588e21be726817fca39510f3" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + [[package]] name = "addr2line" version = "0.21.0" @@ -127,9 +178,9 @@ checksum = "3aa2999eb46af81abb65c2d30d446778d7e613b60bbf4e174a027e80f90a3c14" [[package]] name = "android-activity" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" +checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" dependencies = [ "android-properties", "bitflags 2.6.0", @@ -141,7 +192,7 @@ dependencies = [ "log", "ndk", "ndk-context", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "thiserror", ] @@ -228,9 +279,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "apply" @@ -267,7 +318,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -296,11 +347,11 @@ checksum = "3702cac3c1601410cd655ae41650c4c87f7c3183dca6d1cd9acc4220ed56a8b7" [[package]] name = "ash" -version = "0.37.3+1.3.251" +version = "0.38.0+1.3.281" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" dependencies = [ - "libloading 0.7.4", + "libloading", ] [[package]] @@ -338,7 +389,7 @@ dependencies = [ "url", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.4", + "wayland-protocols", "zbus 4.4.0", ] @@ -524,7 +575,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -559,7 +610,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -648,9 +699,9 @@ dependencies = [ [[package]] name = "avif-serialize" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" +checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62" dependencies = [ "arrayvec", ] @@ -707,25 +758,25 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "bit-set" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" [[package]] name = "bit_field" @@ -781,22 +832,12 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" -dependencies = [ - "objc-sys", -] - [[package]] name = "block2" -version = "0.3.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "block-sys", "objc2", ] @@ -844,15 +885,15 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "syn_derive", ] [[package]] name = "built" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" +checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" [[package]] name = "bumpalo" @@ -901,9 +942,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] @@ -916,7 +957,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -933,9 +974,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "calendrical_calculations" @@ -947,20 +988,6 @@ dependencies = [ "displaydoc", ] -[[package]] -name = "calloop" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" -dependencies = [ - "bitflags 2.6.0", - "log", - "polling 3.7.3", - "rustix 0.38.37", - "slab", - "thiserror", -] - [[package]] name = "calloop" version = "0.13.0" @@ -975,25 +1002,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "calloop-wayland-source" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" -dependencies = [ - "calloop 0.12.4", - "rustix 0.38.37", - "wayland-backend", - "wayland-client", -] - [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop 0.13.0", + "calloop", "rustix 0.38.37", "wayland-backend", "wayland-client", @@ -1001,9 +1016,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.28" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "jobserver", "libc", @@ -1087,7 +1102,7 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", - "libloading 0.8.5", + "libloading", ] [[package]] @@ -1121,7 +1136,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1142,7 +1157,7 @@ dependencies = [ [[package]] name = "clipboard_macos" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "objc", "objc-foundation", @@ -1152,7 +1167,7 @@ dependencies = [ [[package]] name = "clipboard_wayland" version = "0.2.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "dnd", "mime", @@ -1162,7 +1177,7 @@ dependencies = [ [[package]] name = "clipboard_x11" version = "0.4.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "thiserror", "x11rb", @@ -1427,7 +1442,7 @@ dependencies = [ "colorgrad", "cosmic-config", "derive_setters", - "image 0.25.2", + "image 0.25.4", "ron", "serde", "tracing", @@ -1440,14 +1455,14 @@ source = "git+https://github.com/pop-os/cosmic-protocols?rev=c8d3a1c#c8d3a1c3d40 dependencies = [ "cosmic-protocols", "libc", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "wayland-client", ] [[package]] name = "cosmic-comp-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-comp#be38da47e9d778e3917b256faf6870750bb7a4e3" +source = "git+https://github.com/pop-os/cosmic-comp#0092dac08cff7af16c0fd90b9f11d0559163a135" dependencies = [ "cosmic-config", "input", @@ -1457,7 +1472,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1479,7 +1494,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "quote", "syn 1.0.109", @@ -1502,15 +1517,15 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#0ce85da198f02f94ad75441e64c0e165c41eb4ae" +source = "git+https://github.com/pop-os/cosmic-panel#041a44eb6f825b7e0b3d45ccf745252b136d5da9" dependencies = [ "anyhow", "cosmic-config", "ron", "serde", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "tracing", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols-wlr", "xdg-shell-wrapper-config", ] @@ -1522,8 +1537,8 @@ dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.4", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols", + "wayland-protocols-wlr", "wayland-scanner", "wayland-server", ] @@ -1531,7 +1546,7 @@ dependencies = [ [[package]] name = "cosmic-randr" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-randr#71fabbb382fa8cf750f50fb77c4ba014bff80056" +source = "git+https://github.com/pop-os/cosmic-randr#907471b6bc42151ef0ed80a6f595e82b85367dc4" dependencies = [ "cosmic-protocols", "futures-lite 2.3.0", @@ -1541,13 +1556,13 @@ dependencies = [ "tokio", "tracing", "wayland-client", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols-wlr", ] [[package]] name = "cosmic-randr-shell" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-randr#71fabbb382fa8cf750f50fb77c4ba014bff80056" +source = "git+https://github.com/pop-os/cosmic-randr#907471b6bc42151ef0ed80a6f595e82b85367dc4" dependencies = [ "kdl", "slotmap", @@ -1584,7 +1599,7 @@ dependencies = [ "dirs", "downcast-rs", "eyre", - "fontdb", + "fontdb 0.16.2", "freedesktop-desktop-entry", "futures", "hostname-validator", @@ -1592,7 +1607,7 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "icu", - "image 0.25.2", + "image 0.25.4", "indexmap 2.6.0", "itertools 0.13.0", "itoa", @@ -1660,7 +1675,7 @@ dependencies = [ [[package]] name = "cosmic-settings-subscriptions" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-settings-subscriptions#ece1b2475c9eb90e0f2042b743577670e799a010" +source = "git+https://github.com/pop-os/cosmic-settings-subscriptions#ff9883a029b44fb8eafb7c7a06d08b36a563e481" dependencies = [ "cosmic-dbus-networkmanager", "futures", @@ -1704,7 +1719,7 @@ dependencies = [ "freedesktop-icons", "futures-lite 2.3.0", "futures-util", - "image 0.25.2", + "image 0.25.4", "infer", "jxl-oxide", "tokio", @@ -1717,12 +1732,12 @@ version = "0.12.1" source = "git+https://github.com/pop-os/cosmic-text.git#4fe90bb6126c22f589b46768d7754d65ae300c5e" dependencies = [ "bitflags 2.6.0", - "fontdb", + "fontdb 0.16.2", "log", "rangemap", "rayon", - "rustc-hash", - "rustybuzz 0.14.1", + "rustc-hash 1.1.0", + "rustybuzz", "self_cell 1.0.4", "smol_str", "swash", @@ -1737,7 +1752,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "almost", "cosmic-config", @@ -1849,11 +1864,12 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" [[package]] name = "d3d12" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017" dependencies = [ "bitflags 2.6.0", - "libloading 0.8.5", + "libloading", "winapi", ] @@ -1902,7 +1918,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1924,7 +1940,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2008,7 +2024,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2066,7 +2082,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2075,7 +2091,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.5", + "libloading", ] [[package]] @@ -2090,12 +2106,12 @@ dependencies = [ [[package]] name = "dnd" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "bitflags 2.6.0", "mime", "raw-window-handle", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "smithay-clipboard", ] @@ -2114,6 +2130,11 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dpi" +version = "0.1.1" +source = "git+https://github.com/pop-os/winit.git?tag=iced-xdg-surface-0.13#b1852274c0251d7f24ba2cb32fa53812b37b1c79" + [[package]] name = "drm" version = "0.11.1" @@ -2165,17 +2186,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" -[[package]] -name = "enum-repr" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad30c9c0fa1aaf1ae5010dab11f1117b15d35faf62cda4bbbc53b9987950f18" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "enumflags2" version = "0.7.10" @@ -2194,7 +2204,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2317,7 +2327,7 @@ dependencies = [ "bytemuck", "cfg-if", "document-features", - "image 0.25.2", + "image 0.25.4", "num-traits", "thiserror", ] @@ -2354,7 +2364,7 @@ checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", - "libredox 0.1.3", + "libredox", "windows-sys 0.59.0", ] @@ -2393,9 +2403,6 @@ name = "float-cmp" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" -dependencies = [ - "num-traits", -] [[package]] name = "float_next_after" @@ -2423,7 +2430,7 @@ dependencies = [ "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rustc-hash", + "rustc-hash 1.1.0", "self_cell 0.10.3", "smallvec", "unic-langid", @@ -2449,9 +2456,9 @@ dependencies = [ [[package]] name = "flume" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "spin", ] @@ -2462,12 +2469,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foldhash" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" - [[package]] name = "font-types" version = "0.7.2" @@ -2483,7 +2484,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fcfcd44ca6e90c921fee9fa665d530b21ef1327a4c1a6c5250ea44b776ada7" dependencies = [ - "roxmltree 0.20.0", + "roxmltree", ] [[package]] @@ -2500,6 +2501,20 @@ dependencies = [ "ttf-parser 0.20.0", ] +[[package]] +name = "fontdb" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e32eac81c1135c1df01d4e6d4233c47ba11f6a6d07f33e0bba09d18797077770" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.9.5", + "slotmap", + "tinyvec", + "ttf-parser 0.21.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -2518,7 +2533,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2675,7 +2690,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2754,9 +2769,9 @@ dependencies = [ [[package]] name = "gettext-rs" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6716b8a0db461a2720b850ba1623e5b69e4b1aa0224cf5e1fb23a0fe49e65c" +checksum = "a44e92f7dc08430aca7ed55de161253a22276dfd69c5526e5c5e95d1f7cf338a" dependencies = [ "gettext-sys", "locale_config", @@ -2764,24 +2779,14 @@ dependencies = [ [[package]] name = "gettext-sys" -version = "0.21.4" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b8797f28f2dabfbe2caadb6db4f7fd739e251b5ede0a2ba49e506071edcf67" +checksum = "bb45773f5b8945f12aecd04558f545964f943dacda1b1155b3d738f5469ef661" dependencies = [ "cc", "temp-dir", ] -[[package]] -name = "gif" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" -dependencies = [ - "color_quant", - "weezl", -] - [[package]] name = "gif" version = "0.13.1" @@ -2811,9 +2816,9 @@ dependencies = [ [[package]] name = "glam" -version = "0.24.2" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" +checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" [[package]] name = "glob" @@ -2835,24 +2840,13 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c" dependencies = [ "gl_generator", ] -[[package]] -name = "glyphon" -version = "0.5.0" -source = "git+https://github.com/pop-os/glyphon.git?tag=v0.5.0#1b0646ff8f74da92d3be704dfc2257d7f4d7eed8" -dependencies = [ - "cosmic-text", - "etagere", - "lru", - "wgpu", -] - [[package]] name = "gpu-alloc" version = "0.6.0" @@ -2874,9 +2868,9 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" +checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7" dependencies = [ "log", "presser", @@ -2887,9 +2881,9 @@ dependencies = [ [[package]] name = "gpu-descriptor" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" +checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557" dependencies = [ "bitflags 2.6.0", "gpu-descriptor-types", @@ -2898,9 +2892,9 @@ dependencies = [ [[package]] name = "gpu-descriptor-types" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ "bitflags 2.6.0", ] @@ -2955,11 +2949,6 @@ name = "hashbrown" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] [[package]] name = "hassle-rs" @@ -2970,7 +2959,7 @@ dependencies = [ "bitflags 2.6.0", "com", "libc", - "libloading 0.8.5", + "libloading", "thiserror", "widestring", "winapi", @@ -3042,9 +3031,9 @@ dependencies = [ [[package]] name = "i18n-embed" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e901c87176ac0b615033c81dbe927c230f74700abfd60ed953a6f547c87bbe6d" +checksum = "a7839d8c7bb8da7bd58c1112d3a1aeb7f178ff3df4ae87783e758ca3bfb750b7" dependencies = [ "arc-swap", "fluent", @@ -3064,9 +3053,9 @@ dependencies = [ [[package]] name = "i18n-embed-fl" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d73fe51b9655599147183495551696628b335f75b2dbfa225196b16d69d7288e" +checksum = "f6e9571c3cba9eba538eaa5ee40031b26debe76f0c7e17bafc97ea57a76cd82e" dependencies = [ "dashmap", "find-crate", @@ -3075,25 +3064,25 @@ dependencies = [ "i18n-config", "i18n-embed", "lazy_static", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.79", + "syn 2.0.82", "unic-langid", ] [[package]] name = "i18n-embed-impl" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81093c4701672f59416582fe3145676126fd23ba5db910acad0793c1108aaa58" +checksum = "0f2cc0e0523d1fe6fc2c6f66e5038624ea8091b3e7748b5e8e0c84b1698db6c2" dependencies = [ "find-crate", "i18n-config", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3121,15 +3110,14 @@ dependencies = [ [[package]] name = "iced" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "dnd", "iced_accessibility", "iced_core", "iced_futures", "iced_renderer", - "iced_sctk", "iced_widget", "iced_winit", "image 0.24.9", @@ -3141,56 +3129,71 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "accesskit", - "accesskit_unix", + "accesskit_winit", ] [[package]] name = "iced_core" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "bitflags 2.6.0", + "bytes", "dnd", + "glam", "iced_accessibility", "log", "mime", "num-traits", + "once_cell", "palette", "raw-window-handle", + "rustc-hash 2.0.0", "serde", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "smol_str", "thiserror", "web-time", "window_clipboard", - "xxhash-rust", ] [[package]] name = "iced_futures" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "futures", "iced_core", "log", + "rustc-hash 2.0.0", "tokio", "wasm-bindgen-futures", "wasm-timer", ] +[[package]] +name = "iced_glyphon" +version = "0.6.0" +source = "git+https://github.com/pop-os/glyphon.git?tag=iced-0.14-dev#6ef9d12a20cfd0f7bdf38136a26ded9f7459ec8b" +dependencies = [ + "cosmic-text", + "etagere", + "lru", + "rustc-hash 2.0.0", + "wgpu", +] + [[package]] name = "iced_graphics" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "bitflags 2.6.0", "bytemuck", "cosmic-text", - "glam", "half", "iced_core", "iced_futures", @@ -3200,16 +3203,15 @@ dependencies = [ "lyon_path", "once_cell", "raw-window-handle", - "rustc-hash", + "rustc-hash 2.0.0", "thiserror", "unicode-segmentation", - "xxhash-rust", ] [[package]] name = "iced_renderer" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -3220,95 +3222,62 @@ dependencies = [ [[package]] name = "iced_runtime" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ + "bytes", "dnd", "iced_accessibility", "iced_core", "iced_futures", - "smithay-client-toolkit 0.19.2", - "thiserror", - "window_clipboard", -] - -[[package]] -name = "iced_sctk" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" -dependencies = [ - "enum-repr", - "float-cmp", - "futures", - "iced_futures", - "iced_graphics", - "iced_runtime", - "iced_style", - "itertools 0.12.1", - "lazy_static", "raw-window-handle", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "thiserror", - "tracing", - "wayland-backend", - "wayland-protocols 0.32.4", "window_clipboard", - "xkbcommon", - "xkbcommon-dl", - "xkeysym", -] - -[[package]] -name = "iced_style" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" -dependencies = [ - "iced_core", - "once_cell", - "palette", ] [[package]] name = "iced_tiny_skia" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "bytemuck", "cosmic-text", "iced_graphics", - "kurbo", + "kurbo 0.10.4", "log", "resvg", - "rustc-hash", + "rustc-hash 2.0.0", "softbuffer", "tiny-skia", - "xxhash-rust", ] [[package]] name = "iced_wgpu" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "as-raw-xcb-connection", "bitflags 2.6.0", "bytemuck", "futures", "glam", - "glyphon", "guillotiere", + "iced_glyphon", "iced_graphics", "log", "lyon", "once_cell", "raw-window-handle", "resvg", + "rustc-hash 2.0.0", "rustix 0.38.37", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", + "thiserror", "tiny-xlib", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.4", + "wayland-protocols", "wayland-sys", "wgpu", "x11rb", @@ -3316,16 +3285,18 @@ dependencies = [ [[package]] name = "iced_widget" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "dnd", + "iced_accessibility", "iced_renderer", "iced_runtime", - "iced_style", "num-traits", + "once_cell", "ouroboros", - "smithay-client-toolkit 0.19.2", + "rustc-hash 2.0.0", + "smithay-client-toolkit", "thiserror", "unicode-segmentation", "window_clipboard", @@ -3333,31 +3304,30 @@ dependencies = [ [[package]] name = "iced_winit" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "dnd", + "iced_accessibility", + "iced_futures", "iced_graphics", "iced_runtime", - "iced_style", "log", + "raw-window-handle", + "rustc-hash 2.0.0", + "smithay-client-toolkit", "thiserror", "tracing", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-protocols", "web-sys", "winapi", "window_clipboard", "winit", -] - -[[package]] -name = "icrate" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" -dependencies = [ - "block2", - "dispatch", - "objc2", + "xkbcommon", + "xkbcommon-dl", + "xkeysym", ] [[package]] @@ -3708,7 +3678,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3780,7 +3750,7 @@ dependencies = [ "byteorder", "color_quant", "exr", - "gif 0.13.1", + "gif", "jpeg-decoder", "num-traits", "png", @@ -3790,15 +3760,15 @@ dependencies = [ [[package]] name = "image" -version = "0.25.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" +checksum = "bc144d44a31d753b02ce64093d532f55ff8dc4ebf2ffb8a63c0dda691385acae" dependencies = [ "bytemuck", "byteorder-lite", "color_quant", "exr", - "gif 0.13.1", + "gif", "image-webp", "num-traits", "png", @@ -3813,9 +3783,9 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" +checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f" dependencies = [ "byteorder-lite", "quick-error", @@ -3829,9 +3799,18 @@ checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" [[package]] name = "imgref" -version = "1.10.1" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" + +[[package]] +name = "immutable-chunkmap" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" +checksum = "12f97096f508d54f8f8ab8957862eee2ccd628847b6217af1a335e1c44dee578" +dependencies = [ + "arrayvec", +] [[package]] name = "indenter" @@ -3926,7 +3905,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4037,9 +4016,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb94a0ffd3f3ee755c20f7d8752f45cac88605a4dcf808abcff72873296ec7b" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -4065,9 +4044,9 @@ dependencies = [ [[package]] name = "jxl-color" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97f0dd548fabf9c094f9f2304059c86764f606b9040c0bfcfac55f155f423b55" +checksum = "c8ec11695f2091e50531c970ad7eb4819989a20a2c89d68ae1b4f74f48454c10" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -4094,9 +4073,9 @@ dependencies = [ [[package]] name = "jxl-grid" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e941628e8de1dc6ba1d2bba8ebc68a69f8ff50cc7ddce5bc821658d1f4ea6e59" +checksum = "13a28ba2734da33624db4b426b44750a7b1238e6cba65d27b7d84bf3cba7f507" dependencies = [ "tracing", ] @@ -4115,9 +4094,9 @@ dependencies = [ [[package]] name = "jxl-modular" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f48a5d003627f380004c29d35e51672da06ae343a2e6fe8d9c84295b9a3e843" +checksum = "d7e10bbc6041d9ea64bcfc6931ed89f0192954ac0a02bdbad624aa43b345e613" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -4128,9 +4107,9 @@ dependencies = [ [[package]] name = "jxl-oxide" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c209f66ef0fe72df77b44ee6aae98eb87bc2dd236d6981e44e143cc37f33f6e" +checksum = "71f3b9dbe4adefadac57b25a15bf7735202ba58c0e5500c6bfb2d63398bf21c2" dependencies = [ "jxl-bitstream", "jxl-color", @@ -4144,9 +4123,9 @@ dependencies = [ [[package]] name = "jxl-render" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec53c004c9171e89f15ad1f029d6b638cbd70d3a70276746bb8c75f9393bb64" +checksum = "e4259446ca029587f2b7850d223d57b4f69665dd8628e83bcb0a6c2ab964f1ef" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -4212,7 +4191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.5", + "libloading", "pkg-config", ] @@ -4253,11 +4232,22 @@ dependencies = [ [[package]] name = "kurbo" -version = "0.9.5" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1618d4ebd923e97d67e7cd363d80aef35fe961005cbbbb3d2dad8bdd1bc63440" +dependencies = [ + "arrayvec", + "smallvec", +] + +[[package]] +name = "kurbo" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" +checksum = "89234b2cc610a7dd927ebde6b41dd1a5d4214cffaef4cf1fb2195d592f92518f" dependencies = [ "arrayvec", + "smallvec", ] [[package]] @@ -4280,14 +4270,14 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#100f75f88edc5b602e29587fd6698dbf0038901d" +source = "git+https://github.com/pop-os/libcosmic#795654610a2875fe4316add18df6f33a4bc86af1" dependencies = [ "apply", "ashpd 0.9.2", @@ -4301,15 +4291,15 @@ dependencies = [ "fraction", "freedesktop-icons", "iced", + "iced_accessibility", "iced_core", "iced_futures", "iced_renderer", "iced_runtime", - "iced_sctk", - "iced_style", "iced_tiny_skia", "iced_wgpu", "iced_widget", + "iced_winit", "lazy_static", "palette", "rfd", @@ -4337,16 +4327,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "libloading" version = "0.8.5" @@ -4390,17 +4370,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "libredox" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" -dependencies = [ - "bitflags 2.6.0", - "libc", - "redox_syscall 0.4.1", -] - [[package]] name = "libredox" version = "0.1.3" @@ -4536,9 +4505,6 @@ name = "lru" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -dependencies = [ - "hashbrown 0.15.0", -] [[package]] name = "lyon" @@ -4562,9 +4528,9 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edecfb8d234a2b0be031ab02ebcdd9f3b9ee418fb35e265f7a540a48d197bff9" +checksum = "8af69edc087272df438b3ee436c4bb6d7c04aa8af665cfd398feae627dbd8570" dependencies = [ "arrayvec", "euclid", @@ -4573,9 +4539,9 @@ dependencies = [ [[package]] name = "lyon_path" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c08a606c7a59638d6c6aa18ac91a06aa9fb5f765a7efb27e6a4da58700740d7" +checksum = "8e0b8aec2f58586f6eef237985b9a9b7cb3a3aff4417c575075cf95bf925252e" dependencies = [ "lyon_geom", "num-traits", @@ -4663,9 +4629,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ "bitflags 2.6.0", "block", @@ -4696,13 +4662,13 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "mime" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "smithay-clipboard", ] @@ -4764,18 +4730,19 @@ checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" [[package]] name = "naga" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" dependencies = [ "arrayvec", "bit-set", "bitflags 2.6.0", + "cfg_aliases 0.1.1", "codespan-reporting", "hexf-parse", "indexmap 2.6.0", "log", - "num-traits", - "rustc-hash", + "rustc-hash 1.1.0", "spirv", "termcolor", "thiserror", @@ -4784,14 +4751,14 @@ dependencies = [ [[package]] name = "ndk" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ "bitflags 2.6.0", "jni-sys", "log", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "raw-window-handle", "thiserror", @@ -4812,6 +4779,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -4966,7 +4942,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5038,7 +5014,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5048,7 +5024,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", - "objc_exception", ] [[package]] @@ -5070,27 +5045,199 @@ checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" [[package]] name = "objc2" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" dependencies = [ "objc-sys", "objc2-encode", ] +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.6.0", + "block2", + "libc", + "objc2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2", + "objc2", + "objc2-contacts", + "objc2-foundation", +] + [[package]] name = "objc2-encode" -version = "3.0.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" +checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" [[package]] -name = "objc_exception" -version = "0.1.2" +name = "objc2-foundation" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "cc", + "bitflags 2.6.0", + "block2", + "dispatch", + "libc", + "objc2", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2", + "objc2", + "objc2-app-kit", + "objc2-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", ] [[package]] @@ -5125,11 +5272,11 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orbclient" -version = "0.3.47" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" +checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" dependencies = [ - "libredox 0.0.2", + "libredox", ] [[package]] @@ -5154,9 +5301,9 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.17.2" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ba07320d39dfea882faa70554b4bd342a5f273ed59ba7c1c6b4c840492c954" +checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67" dependencies = [ "aliasable", "ouroboros_macro", @@ -5165,15 +5312,16 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.17.2" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" +checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" dependencies = [ "heck 0.4.1", - "proc-macro-error", + "itertools 0.12.1", "proc-macro2", + "proc-macro2-diagnostics", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5219,7 +5367,7 @@ dependencies = [ "by_address", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5318,7 +5466,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5327,7 +5475,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -5336,6 +5484,26 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -5492,7 +5660,6 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", "version_check", ] @@ -5507,15 +5674,50 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.82", +] + [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", + "version_check", + "yansi", +] + [[package]] name = "procfs" version = "0.16.0" @@ -5541,21 +5743,21 @@ dependencies = [ [[package]] name = "profiling" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" dependencies = [ "profiling-procmacros", ] [[package]] name = "profiling-procmacros" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" +checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" dependencies = [ "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5696,9 +5898,9 @@ dependencies = [ [[package]] name = "ravif" -version = "0.11.10" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f0bfd976333248de2078d350bfdf182ff96e168a24d23d2436cef320dd4bdd" +checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" dependencies = [ "avif-serialize", "imgref", @@ -5734,17 +5936,11 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rctree" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" - [[package]] name = "read-fonts" -version = "0.22.3" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb94d9ac780fdcf9b6b252253f7d8f221379b84bd3573131139b383df69f85e1" +checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229" dependencies = [ "bytemuck", "font-types", @@ -5759,15 +5955,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -5793,7 +5980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", - "libredox 0.1.3", + "libredox", "thiserror", ] @@ -5867,15 +6054,14 @@ checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" [[package]] name = "resvg" -version = "0.37.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadccb3d99a9efb8e5e00c16fbb732cbe400db2ec7fc004697ee7d97d86cf1f4" +checksum = "944d052815156ac8fa77eaac055220e95ba0b01fa8887108ca710c03805d9051" dependencies = [ - "gif 0.12.0", + "gif", "jpeg-decoder", "log", "pico-args", - "png", "rgb", "svgtypes", "tiny-skia", @@ -5955,12 +6141,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "roxmltree" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" - [[package]] name = "roxmltree" version = "0.20.0" @@ -5987,7 +6167,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.79", + "syn 2.0.82", "walkdir", ] @@ -6039,6 +6219,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" version = "0.37.27" @@ -6068,25 +6254,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "rustybuzz" -version = "0.12.1" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" -dependencies = [ - "bitflags 2.6.0", - "bytemuck", - "smallvec", - "ttf-parser 0.20.0", - "unicode-bidi-mirroring 0.1.0", - "unicode-ccc 0.1.2", - "unicode-properties", - "unicode-script", -] +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rustybuzz" @@ -6099,8 +6269,8 @@ dependencies = [ "libm", "smallvec", "ttf-parser 0.21.1", - "unicode-bidi-mirroring 0.2.0", - "unicode-ccc 0.2.0", + "unicode-bidi-mirroring", + "unicode-ccc", "unicode-properties", "unicode-script", ] @@ -6134,14 +6304,14 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.8.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b31447ca297092c5a9916fc3b955203157b37c19ca8edde4f52e9843e602c7" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" dependencies = [ "ab_glyph", "log", "memmap2 0.9.5", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "tiny-skia", ] @@ -6178,9 +6348,9 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] @@ -6199,20 +6369,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap 2.6.0", "itoa", @@ -6229,7 +6399,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6268,7 +6438,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6353,6 +6523,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "skrifa" version = "0.22.3" @@ -6387,31 +6563,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smithay-client-toolkit" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" -dependencies = [ - "bitflags 2.6.0", - "calloop 0.12.4", - "calloop-wayland-source 0.2.0", - "cursor-icon", - "libc", - "log", - "memmap2 0.9.5", - "rustix 0.38.37", - "thiserror", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols 0.31.2", - "wayland-protocols-wlr 0.2.0", - "wayland-scanner", - "xkeysym", -] - [[package]] name = "smithay-client-toolkit" version = "0.19.2" @@ -6420,8 +6571,8 @@ checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.6.0", "bytemuck", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", + "calloop", + "calloop-wayland-source", "cursor-icon", "libc", "log", @@ -6433,8 +6584,8 @@ dependencies = [ "wayland-client", "wayland-csd-frame", "wayland-cursor", - "wayland-protocols 0.32.4", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols", + "wayland-protocols-wlr", "wayland-scanner", "xkbcommon", "xkeysym", @@ -6447,7 +6598,7 @@ source = "git+https://github.com/pop-os/smithay-clipboard?tag=pop-dnd-5#5a3007de dependencies = [ "libc", "raw-window-handle", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "wayland-backend", ] @@ -6606,12 +6757,12 @@ checksum = "20e16a0f46cf5fd675563ef54f26e83e20f2366bcf027bcb3cc3ed2b98aaf2ca" [[package]] name = "svgtypes" -version = "0.13.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e44e288cd960318917cbd540340968b90becc8bc81f171345d706e7a89d9d70" +checksum = "794de53cc48eaabeed0ab6a3404a65f40b3e38c067e4435883a65d2aa4ca000e" dependencies = [ - "kurbo", - "siphasher", + "kurbo 0.11.1", + "siphasher 1.0.1", ] [[package]] @@ -6638,9 +6789,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -6656,7 +6807,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6667,7 +6818,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6778,22 +6929,22 @@ checksum = "7f1835c76a9d443834c04539860f3ce46b9d93ef8c260057f939e967ca81180a" [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6899,7 +7050,7 @@ checksum = "1d52f22673960ad13af14ff4025997312def1223bfa7c8e4949d099e6b3d5d1c" dependencies = [ "as-raw-xcb-connection", "ctor-lite", - "libloading 0.8.5", + "libloading", "pkg-config", "tracing", ] @@ -6931,9 +7082,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -6955,7 +7106,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -7042,7 +7193,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -7118,7 +7269,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] @@ -7129,9 +7280,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "udev" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba005bcd5b1158ae3cd815905990e8b6ee4ba9ee7adbab6d7b58d389ad09c93" +checksum = "e3d5c197b95f1769931c89f85c33c407801d1fb7a311113bc0b39ad036f1bd81" dependencies = [ "io-lifetimes 1.0.11", "libc", @@ -7175,24 +7326,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" -[[package]] -name = "unicode-bidi-mirroring" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" - [[package]] name = "unicode-bidi-mirroring" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" -[[package]] -name = "unicode-ccc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" - [[package]] name = "unicode-ccc" version = "0.2.0" @@ -7299,63 +7438,29 @@ dependencies = [ [[package]] name = "usvg" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b0a51b72ab80ca511d126b77feeeb4fb1e972764653e61feac30adc161a756" -dependencies = [ - "base64 0.21.7", - "log", - "pico-args", - "usvg-parser", - "usvg-text-layout", - "usvg-tree", - "xmlwriter", -] - -[[package]] -name = "usvg-parser" -version = "0.37.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd4e3c291f45d152929a31f0f6c819245e2921bfd01e7bd91201a9af39a2bdc" +checksum = "b84ea542ae85c715f07b082438a4231c3760539d902e11d093847a0b22963032" dependencies = [ + "base64 0.22.1", "data-url", "flate2", + "fontdb 0.18.0", "imagesize", - "kurbo", + "kurbo 0.11.1", "log", - "roxmltree 0.19.0", + "pico-args", + "roxmltree", + "rustybuzz", "simplecss", - "siphasher", + "siphasher 1.0.1", + "strict-num", "svgtypes", - "usvg-tree", -] - -[[package]] -name = "usvg-text-layout" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d383a3965de199d7f96d4e11a44dd859f46e86de7f3dca9a39bf82605da0a37c" -dependencies = [ - "fontdb", - "kurbo", - "log", - "rustybuzz 0.12.1", + "tiny-skia-path", "unicode-bidi", "unicode-script", "unicode-vo", - "usvg-tree", -] - -[[package]] -name = "usvg-tree" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee3d202ebdb97a6215604b8f5b4d6ef9024efd623cf2e373a6416ba976ec7d3" -dependencies = [ - "rctree", - "strict-num", - "svgtypes", - "tiny-skia-path", + "xmlwriter", ] [[package]] @@ -7384,9 +7489,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" [[package]] name = "v_frame" @@ -7441,9 +7546,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -7452,24 +7557,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65471f79c1022ffa5291d33520cbbb53b7687b01c2f8e83b57d102eed7ed479d" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -7479,9 +7584,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7489,22 +7594,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-timer" @@ -7569,18 +7674,6 @@ dependencies = [ "xcursor", ] -[[package]] -name = "wayland-protocols" -version = "0.31.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - [[package]] name = "wayland-protocols" version = "0.32.4" @@ -7596,27 +7689,14 @@ dependencies = [ [[package]] name = "wayland-protocols-plasma" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-protocols 0.31.2", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +checksum = "8a0a41a6875e585172495f7a96dfa42ca7e0213868f4f15c313f7c33221a7eff" dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-scanner", ] @@ -7629,7 +7709,7 @@ dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.4", + "wayland-protocols", "wayland-scanner", "wayland-server", ] @@ -7673,9 +7753,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44188d185b5bdcae1052d08bcbcf9091a5524038d4572cc4f4f2bb9d5554ddd9" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -7683,9 +7763,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -7699,12 +7779,13 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" dependencies = [ "arrayvec", - "cfg-if", "cfg_aliases 0.1.1", + "document-features", "js-sys", "log", "naga", @@ -7723,14 +7804,15 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" dependencies = [ "arrayvec", "bit-vec", "bitflags 2.6.0", "cfg_aliases 0.1.1", - "codespan-reporting", + "document-features", "indexmap 2.6.0", "log", "naga", @@ -7738,18 +7820,18 @@ dependencies = [ "parking_lot 0.12.3", "profiling", "raw-window-handle", - "rustc-hash", + "rustc-hash 1.1.0", "smallvec", "thiserror", - "web-sys", "wgpu-hal", "wgpu-types", ] [[package]] name = "wgpu-hal" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" dependencies = [ "android_system_properties", "arrayvec", @@ -7769,10 +7851,11 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.5", + "libloading", "log", "metal", "naga", + "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", "parking_lot 0.12.3", @@ -7780,7 +7863,7 @@ dependencies = [ "range-alloc", "raw-window-handle", "renderdoc-sys", - "rustc-hash", + "rustc-hash 1.1.0", "smallvec", "thiserror", "wasm-bindgen", @@ -7791,8 +7874,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d" dependencies = [ "bitflags 2.6.0", "js-sys", @@ -7839,7 +7923,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window_clipboard" version = "0.4.1" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "clipboard-win", "clipboard_macos", @@ -7870,6 +7954,18 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-implement 0.53.0", + "windows-interface 0.53.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows" version = "0.57.0" @@ -7889,18 +7985,39 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.57.0", + "windows-interface 0.57.0", "windows-result", "windows-targets 0.52.6", ] +[[package]] +name = "windows-implement" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", +] + [[package]] name = "windows-implement" version = "0.57.0" @@ -7909,7 +8026,18 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", +] + +[[package]] +name = "windows-interface" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", ] [[package]] @@ -7920,7 +8048,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -8148,46 +8276,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.29.10" -source = "git+https://github.com/pop-os/winit.git?branch=winit-0.29#bdc66109acc85c912264c9e4b864520345bdb45f" +version = "0.30.5" +source = "git+https://github.com/pop-os/winit.git?tag=iced-xdg-surface-0.13#b1852274c0251d7f24ba2cb32fa53812b37b1c79" dependencies = [ "ahash 0.8.11", "android-activity", "atomic-waker", "bitflags 2.6.0", + "block2", "bytemuck", - "calloop 0.12.4", - "cfg_aliases 0.1.1", + "calloop", + "cfg_aliases 0.2.1", + "concurrent-queue", "core-foundation", "core-graphics", "cursor-icon", - "icrate", + "dpi", "js-sys", "libc", - "log", "memmap2 0.9.5", "ndk", - "ndk-sys", "objc2", - "once_cell", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", "orbclient", "percent-encoding", + "pin-project", "raw-window-handle", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix 0.38.37", "sctk-adwaita", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "smol_str", + "tracing", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", "wayland-client", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-protocols-plasma", "web-sys", "web-time", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "x11-dl", "x11rb", "xkbcommon-dl", @@ -8255,7 +8387,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading 0.8.5", + "libloading", "once_cell", "rustix 0.38.37", "x11rb-protocol", @@ -8292,10 +8424,10 @@ dependencies = [ [[package]] name = "xdg-shell-wrapper-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#0ce85da198f02f94ad75441e64c0e165c41eb4ae" +source = "git+https://github.com/pop-os/cosmic-panel#041a44eb6f825b7e0b3d45ccf745252b136d5da9" dependencies = [ "serde", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols-wlr", ] [[package]] @@ -8354,10 +8486,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] -name = "xxhash-rust" -version = "0.8.12" +name = "yansi" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yansi-term" @@ -8394,7 +8526,7 @@ checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "synstructure", ] @@ -8496,7 +8628,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "zvariant_utils 2.1.0", ] @@ -8546,7 +8678,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -8566,7 +8698,7 @@ checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "synstructure", ] @@ -8606,7 +8738,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -8683,7 +8815,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "zvariant_utils 2.1.0", ] @@ -8706,5 +8838,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] diff --git a/Cargo.toml b/Cargo.toml index 52621faa..b53bc002 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,16 +11,8 @@ cosmic-randr = { git = "https://github.com/pop-os/cosmic-randr" } tokio = { version = "1.40.0", features = ["macros"] } [workspace.dependencies.libcosmic] +features = ["multi-window", "winit", "tokio", "xdg-portal"] git = "https://github.com/pop-os/libcosmic" -features = [ - "dbus-config", - "single-instance", - "multi-window", - "tokio", - "wayland", - "wgpu", - "xdg-portal", -] [workspace.dependencies.cosmic-config] git = "https://github.com/pop-os/libcosmic" @@ -44,7 +36,6 @@ package = "smithay-client-toolkit" # rev = "c583de8" [profile.release] -opt-level = 3 lto = "thin" # [patch.'https://github.com/smithay/client-toolkit/'] diff --git a/cosmic-settings/Cargo.toml b/cosmic-settings/Cargo.toml index 3af60d52..8d33ee3c 100644 --- a/cosmic-settings/Cargo.toml +++ b/cosmic-settings/Cargo.toml @@ -76,6 +76,10 @@ version = "0.15.0" features = ["fluent-system", "desktop-requester"] [features] -default = [] +default = ["wayland", "dbus-config", "single-instance", "a11y", "wgpu"] +wayland = ["libcosmic/wayland"] +dbus-config = ["libcosmic/dbus-config"] +single-instance = ["libcosmic/single-instance"] +a11y = ["libcosmic/a11y"] wgpu = ["libcosmic/wgpu"] test = [] diff --git a/cosmic-settings/src/app.rs b/cosmic-settings/src/app.rs index a9cc1fed..2b1c537f 100644 --- a/cosmic-settings/src/app.rs +++ b/cosmic-settings/src/app.rs @@ -2,30 +2,25 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::config::Config; -use crate::pages::desktop::{ - self, appearance, dock, - panel::{ - self, - applets_inner::{self, APPLET_DND_ICON_ID}, - inner as _panel, - }, -}; +use crate::pages::desktop::{self, appearance}; use crate::pages::input::{self}; use crate::pages::{self, bluetooth, display, networking, power, sound, system, time}; use crate::subscription::desktop_files; use crate::widget::{page_title, search_header}; use crate::PageCommands; +use cosmic::app::command::set_theme; +#[cfg(feature = "single-instance")] use cosmic::app::DbusActivationMessage; -use cosmic::cctk::sctk::output::OutputInfo; -use cosmic::cctk::wayland_client::protocol::wl_output::WlOutput; +#[cfg(feature = "wayland")] +use cosmic::cctk::{sctk::output::OutputInfo, wayland_client::protocol::wl_output::WlOutput}; use cosmic::iced::futures::SinkExt; -use cosmic::iced::Subscription; +use cosmic::iced::{stream, Subscription}; use cosmic::widget::{self, button, row, text_input}; use cosmic::{ - app::{Command, Core}, + app::{Core, Task}, iced::{ self, - event::{self, wayland, PlatformSpecific}, + event::{self, PlatformSpecific}, window, Length, }, prelude::*, @@ -36,6 +31,13 @@ use cosmic::{ }; use cosmic_panel_config::CosmicPanelConfig; use cosmic_settings_page::{self as page, section}; +#[cfg(feature = "wayland")] +use desktop::{ + dock, + panel::{self, applets_inner, inner as _panel}, +}; +#[cfg(feature = "wayland")] +use event::wayland; use page::Entity; use std::{borrow::Cow, str::FromStr}; @@ -55,7 +57,7 @@ pub struct SettingsApp { } impl SettingsApp { - fn subcommand_to_page(&self, cmd: &PageCommands) -> Option { + fn subtask_to_page(&self, cmd: &PageCommands) -> Option { match cmd { PageCommands::About => self.pages.page_id::(), PageCommands::Appearance => self.pages.page_id::(), @@ -63,12 +65,14 @@ impl SettingsApp { PageCommands::DateTime => self.pages.page_id::(), PageCommands::Desktop => self.pages.page_id::(), PageCommands::Displays => self.pages.page_id::(), + #[cfg(feature = "wayland")] PageCommands::Dock => self.pages.page_id::(), PageCommands::Firmware => self.pages.page_id::(), PageCommands::Input => self.pages.page_id::(), PageCommands::Keyboard => self.pages.page_id::(), PageCommands::Mouse => self.pages.page_id::(), PageCommands::Network => self.pages.page_id::(), + #[cfg(feature = "wayland")] PageCommands::Panel => self.pages.page_id::(), PageCommands::Power => self.pages.page_id::(), PageCommands::RegionLanguage => self.pages.page_id::(), @@ -98,14 +102,18 @@ impl SettingsApp { pub enum Message { CloseContextDrawer, DelayedInit(page::Entity), + #[cfg(feature = "wayland")] DesktopInfo, Error(String), None, OpenContextDrawer(Cow<'static, str>), + #[cfg(feature = "wayland")] OutputAdded(OutputInfo, WlOutput), + #[cfg(feature = "wayland")] OutputRemoved(WlOutput), Page(page::Entity), PageMessage(crate::pages::Message), + #[cfg(feature = "wayland")] PanelConfig(CosmicPanelConfig), RegisterSubscriptionSender(tokio::sync::mpsc::Sender), SearchActivate, @@ -131,7 +139,7 @@ impl cosmic::Application for SettingsApp { &mut self.core } - fn init(core: Core, flags: Self::Flags) -> (Self, Command) { + fn init(core: Core, flags: Self::Flags) -> (Self, Task) { let mut app = SettingsApp { active_page: page::Entity::default(), config: Config::new(), @@ -155,8 +163,8 @@ impl cosmic::Application for SettingsApp { app.insert_page::(); app.insert_page::(); - let active_id = match flags.subcommand { - Some(p) => app.subcommand_to_page(&p), + let active_id = match flags.sub_command { + Some(p) => app.subtask_to_page(&p), None => app .pages .find_page_by_id(&app.config.active_page) @@ -196,48 +204,35 @@ impl cosmic::Application for SettingsApp { widgets } - fn on_escape(&mut self) -> Command { + fn on_escape(&mut self) -> Task { if self.search_active { self.search_active = false; self.search_clear(); } - Command::none() + Task::none() } - fn on_nav_select(&mut self, id: nav_bar::Id) -> Command { + fn on_nav_select(&mut self, id: nav_bar::Id) -> Task { if let Some(page) = self.nav_model.data::(id).copied() { return self.activate_page(page); } - Command::none() + Task::none() } - fn on_search(&mut self) -> Command { + fn on_search(&mut self) -> Task { self.search_active = true; cosmic::widget::text_input::focus(self.search_id.clone()) } fn subscription(&self) -> Subscription { - // Handling of Wayland-specific events received. - let wayland_events = - event::listen_with(|event, _| match event { - iced::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::Output(wayland::OutputEvent::Created(Some(info)), o), - )) if info.name.is_some() => Some(Message::OutputAdded(info, o)), - iced::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::Output(wayland::OutputEvent::Removed, o), - )) => Some(Message::OutputRemoved(o)), - _ => None, - }); - Subscription::batch(vec![ // Creates a channel that listens to messages from pages. // The sender is given back to the application so that it may pass it on. - cosmic::iced::subscription::channel( + Subscription::run_with_id( std::any::TypeId::of::(), - 4, - move |mut output| async move { + stream::channel(4, move |mut output| async move { let (tx, mut rx) = tokio::sync::mpsc::channel::(4); let _res = output.send(Message::RegisterSubscriptionSender(tx)).await; @@ -246,18 +241,31 @@ impl cosmic::Application for SettingsApp { let _res = output.send(Message::PageMessage(event)).await; } - futures::future::pending().await - }, + futures::future::pending::<()>().await; + }), ), crate::subscription::daytime().map(|daytime| { Message::PageMessage(pages::Message::Appearance(appearance::Message::Daytime( daytime, ))) }), - wayland_events, + #[cfg(feature = "wayland")] + event::listen_with(|event, _, _id| match event { + #[cfg(feature = "wayland")] + iced::Event::PlatformSpecific(PlatformSpecific::Wayland( + wayland::Event::Output(wayland::OutputEvent::Created(Some(info)), o), + )) if info.name.is_some() => Some(Message::OutputAdded(info, o)), + #[cfg(feature = "wayland")] + iced::Event::PlatformSpecific(PlatformSpecific::Wayland( + wayland::Event::Output(wayland::OutputEvent::Removed, o), + )) => Some(Message::OutputRemoved(o)), + _ => None, + }), + #[cfg(feature = "wayland")] // Watch for changes to installed desktop entries desktop_files(0).map(|_| Message::DesktopInfo), // Watch for configuration changes to the panel. + #[cfg(feature = "wayland")] self.core() .watch_config::("com.system76.CosmicPanel.Panel") .map(|update| { @@ -267,7 +275,7 @@ impl cosmic::Application for SettingsApp { Message::PanelConfig(update.config) }), - // Watch for configuration changes to the dock + #[cfg(feature = "wayland")] self.core() .watch_config::("com.system76.CosmicPanel.Dock") .map(|update| { @@ -289,7 +297,7 @@ impl cosmic::Application for SettingsApp { } #[allow(clippy::too_many_lines)] - fn update(&mut self, message: Message) -> Command { + fn update(&mut self, message: Message) -> Task { match message { Message::Page(page) => return self.activate_page(page), @@ -357,12 +365,14 @@ impl cosmic::Application for SettingsApp { } } + #[cfg(feature = "wayland")] crate::pages::Message::Dock(message) => { if let Some(page) = self.pages.page_mut::() { return page.update(message).map(Into::into); } } + #[cfg(feature = "wayland")] crate::pages::Message::DockApplet(message) => { if let Some(page) = self.pages.page_mut::() { return page.update(message).map(Into::into); @@ -461,12 +471,14 @@ impl cosmic::Application for SettingsApp { } } + #[cfg(feature = "wayland")] crate::pages::Message::Panel(message) => { if let Some(page) = self.pages.page_mut::() { return page.update(message).map(Into::into); } } + #[cfg(feature = "wayland")] crate::pages::Message::PanelApplet(message) => { if let Some(page) = self.pages.page_mut::() { return page.update(message).map(Into::into); @@ -500,6 +512,7 @@ impl cosmic::Application for SettingsApp { } }, + #[cfg(feature = "wayland")] Message::OutputAdded(info, output) => { let mut commands = vec![]; if let Some(page) = self.pages.page_mut::() { @@ -521,9 +534,10 @@ impl cosmic::Application for SettingsApp { .map(Into::into), ); } - return Command::batch(commands); + return Task::batch(commands); } + #[cfg(feature = "wayland")] Message::OutputRemoved(output) => { let mut commands = vec![]; if let Some(page) = self.pages.page_mut::() { @@ -541,34 +555,36 @@ impl cosmic::Application for SettingsApp { .map(Into::into), ); } - return Command::batch(commands); + return Task::batch(commands); } + #[cfg(feature = "wayland")] Message::PanelConfig(config) if config.name.to_lowercase().contains("panel") => { - let mut commands = Vec::new(); + let mut tasks = Vec::new(); if let Some(page) = self.pages.page_mut::() { - commands.push( + tasks.push( page.update(panel::Message(_panel::Message::PanelConfig(config.clone()))) .map(Into::into), ); } if let Some(page) = self.pages.page_mut::() { - commands.push( + tasks.push( page.update(applets_inner::Message::PanelConfig(config)) .map(Into::into), ); } - return Command::batch(commands); + return Task::batch(tasks); } + #[cfg(feature = "wayland")] Message::PanelConfig(config) if config.name.to_lowercase().contains("dock") => { - let mut commands = Vec::new(); + let mut tasks = Vec::new(); if let Some(page) = self.pages.page_mut::() { - commands.push( + tasks.push( page.update(dock::Message::Inner(_panel::Message::PanelConfig( config.clone(), ))) @@ -577,7 +593,7 @@ impl cosmic::Application for SettingsApp { } if let Some(page) = self.pages.page_mut::() { - commands.push( + tasks.push( page.update(dock::applets::Message(applets_inner::Message::PanelConfig( config, ))) @@ -585,11 +601,12 @@ impl cosmic::Application for SettingsApp { ); } - return Command::batch(commands); + return Task::batch(tasks); } + #[cfg(feature = "wayland")] Message::PanelConfig(_) => {} - + #[cfg(feature = "wayland")] Message::DesktopInfo => { let info_list: Vec<_> = freedesktop_desktop_entry::Iter::new( freedesktop_desktop_entry::default_paths(), @@ -609,7 +626,7 @@ impl cosmic::Application for SettingsApp { } } - Message::SetTheme(t) => return cosmic::app::command::set_theme(t), + Message::SetTheme(t) => return set_theme(t), Message::OpenContextDrawer(title) => { self.core.window.show_context = true; @@ -638,21 +655,22 @@ impl cosmic::Application for SettingsApp { } } - Command::none() + Task::none() } - fn dbus_activation(&mut self, msg: DbusActivationMessage) -> Command { + #[cfg(feature = "single-instance")] + fn dbus_activation(&mut self, msg: DbusActivationMessage) -> Task { match msg.msg { cosmic::app::DbusActivationDetails::Activate | cosmic::app::DbusActivationDetails::Open { .. } => None, cosmic::app::DbusActivationDetails::ActivateAction { action, .. } => { PageCommands::from_str(&action) .ok() - .and_then(|action| self.subcommand_to_page(&action)) + .and_then(|action| self.subtask_to_page(&action)) .map(|e| self.activate_page(e)) } } - .unwrap_or_else(Command::none) + .unwrap_or_else(Task::none) } fn view(&self) -> Element { @@ -673,12 +691,6 @@ impl cosmic::Application for SettingsApp { #[allow(clippy::too_many_lines)] fn view_window(&self, id: window::Id) -> Element { - if let Some(Some(page)) = - (id == *APPLET_DND_ICON_ID).then(|| self.pages.page::()) - { - return page.dnd_icon(); - } - panic!("unknown window ID: {id:?}"); } @@ -699,7 +711,7 @@ impl cosmic::Application for SettingsApp { } fn on_close_requested(&self, id: window::Id) -> Option { - if id == window::Id::MAIN { + if id == self.core.main_window_id().unwrap() { std::thread::spawn(|| { std::thread::sleep(tokio::time::Duration::from_millis(100)); std::process::exit(0); @@ -711,17 +723,17 @@ impl cosmic::Application for SettingsApp { impl SettingsApp { /// Activates a page. - fn activate_page(&mut self, page: page::Entity) -> Command { + fn activate_page(&mut self, page: page::Entity) -> Task { let current_page = self.active_page; self.active_page = page; - let mut leave_command = iced::Command::none(); + let mut leave_task = iced::Task::none(); if current_page != page { - leave_command = self + leave_task = self .pages .on_leave(current_page) - .unwrap_or(iced::Command::none()) + .unwrap_or(iced::Task::none()) .map(Message::PageMessage) .map(Into::into); self.config.active_page = Box::from(&*self.pages.info[page].id); @@ -738,26 +750,26 @@ impl SettingsApp { .clone() .expect("sender should be available"); - let page_command = self + let page_task = self .pages .on_enter(page, sender) .map(Message::PageMessage) .map(Into::into); - Command::batch(vec![ - leave_command, - page_command, + Task::batch(vec![ + leave_task, + page_task, cosmic::command::future(async { Message::SetWindowTitle }), ]) } - fn set_title(&mut self) -> Command { + fn set_title(&mut self) -> Task { self.set_window_title( format!( "{} - COSMIC Settings", self.pages.info[self.active_page].title ), - window::Id::MAIN, + self.core.main_window_id().unwrap(), ) } @@ -806,14 +818,14 @@ impl SettingsApp { custom_header.map(Message::from) } else if let Some(parent) = page_info.parent { let page_header = crate::widget::sub_page_header( - page.title().unwrap_or_else(|| page_info.title.as_str()), + page.title().unwrap_or(page_info.title.as_str()), self.pages.info[parent].title.as_str(), Message::Page(parent), ); let mut page_header_content: cosmic::iced_widget::Row<'_, Message, Theme> = row::with_capacity(2) - .align_items(iced::Alignment::End) + .align_y(iced::Alignment::End) .push(page_header); if let Some(element) = page.header_view() { @@ -849,7 +861,7 @@ impl SettingsApp { widget::column::with_capacity(3) .push(self.page_container(header)) - .push(widget::vertical_space(Length::Fixed( + .push(widget::vertical_space().height(Length::Fixed( cosmic::theme::active().cosmic().space_m().into(), ))) .push(view) @@ -953,7 +965,7 @@ impl SettingsApp { widget::column::with_capacity(3) .push(self.page_container(page_title(&self.pages.info[self.active_page]))) - .push(widget::vertical_space(theme.cosmic().space_m())) + .push(widget::vertical_space().height(theme.cosmic().space_m())) .push(page_list) .height(Length::Fill) .into() @@ -975,9 +987,8 @@ impl SettingsApp { .max_width(800) .width(Length::Fill) .apply(container) - .center_x() + .center_x(Length::Fill) .padding([0, padding]) - .width(Length::Fill) .into() } } diff --git a/cosmic-settings/src/main.rs b/cosmic-settings/src/main.rs index 008126db..8914f803 100644 --- a/cosmic-settings/src/main.rs +++ b/cosmic-settings/src/main.rs @@ -33,7 +33,7 @@ use tracing_subscriber::prelude::*; #[command(propagate_version = true)] pub struct Args { #[command(subcommand)] - subcommand: Option, + sub_command: Option, } #[derive(Subcommand, Debug, Serialize, Deserialize, Clone)] @@ -50,6 +50,7 @@ pub enum PageCommands { Desktop, /// Displays settings page Displays, + #[cfg(feature = "wayland")] /// Dock settings page Dock, /// Firmware settings page @@ -62,6 +63,7 @@ pub enum PageCommands { Mouse, /// Network settings page Network, + #[cfg(feature = "wayland")] /// Panel settings page Panel, /// Power settings page @@ -100,9 +102,9 @@ impl FromStr for PageCommands { } } -impl ToString for PageCommands { - fn to_string(&self) -> String { - ron::ser::to_string(self).unwrap() +impl std::fmt::Display for PageCommands { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", ron::ser::to_string(self).unwrap()) } } @@ -111,7 +113,7 @@ impl CosmicFlags for Args { type Args = Vec; fn action(&self) -> Option<&PageCommands> { - self.subcommand.as_ref() + self.sub_command.as_ref() } } @@ -131,11 +133,16 @@ pub fn main() -> color_eyre::Result<()> { let args = Args::parse(); let settings = cosmic::app::Settings::default() - .size_limits(Limits::NONE.min_width(360.0).min_height(300.0)) - .exit_on_close(false); - - cosmic::app::run_single_instance::(settings, args)?; + .size_limits(Limits::NONE.min_width(360.0).min_height(300.0)); + #[cfg(feature = "single-instance")] + { + cosmic::app::run_single_instance::(settings, args)?; + } + #[cfg(not(feature = "single-instance"))] + { + cosmic::app::run::(settings, args)?; + } Ok(()) } diff --git a/cosmic-settings/src/pages/bluetooth/backend.rs b/cosmic-settings/src/pages/bluetooth/backend.rs index f020f387..dcede1cd 100644 --- a/cosmic-settings/src/pages/bluetooth/backend.rs +++ b/cosmic-settings/src/pages/bluetooth/backend.rs @@ -365,11 +365,11 @@ pub async fn start_discovery( } } - return if let Err(why) = result { + if let Err(why) = result { Message::DBusError(why.to_string()) } else { Message::Nop - }; + } } pub async fn stop_discovery( @@ -521,11 +521,11 @@ pub async fn forget_device(connection: zbus::Connection, device_path: OwnedObjec } } - return if result.is_err() { + if result.is_err() { Message::DeviceFailed(device_path) } else { Message::Nop - }; + } } pub async fn change_adapter_status( @@ -558,7 +558,7 @@ pub async fn change_adapter_status( if let Err(why) = result { tracing::error!("Failed to change the adapter state!"); - return Message::DBusError(why.to_string()).into(); + return Message::DBusError(why.to_string()); } Message::Nop diff --git a/cosmic-settings/src/pages/bluetooth/mod.rs b/cosmic-settings/src/pages/bluetooth/mod.rs index 1b79b239..5be239d5 100644 --- a/cosmic-settings/src/pages/bluetooth/mod.rs +++ b/cosmic-settings/src/pages/bluetooth/mod.rs @@ -2,10 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only use cosmic::iced::{alignment, color, Length}; -use cosmic::iced_core::text::Wrap; -use cosmic::prelude::CollectionWidget; +use cosmic::iced_core::text::Wrapping; use cosmic::widget::{self, settings, text}; -use cosmic::Command; +use cosmic::Task; use cosmic::{Apply, Element}; use cosmic_settings_page::{self as page, section, Section}; use futures::channel::oneshot; @@ -78,7 +77,7 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { + ) -> cosmic::Task { // TODO start stream for new device cosmic::command::future(async move { match zbus::Connection::system().await { @@ -88,7 +87,7 @@ impl page::Page for Page { }) } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { if let Some(cancel) = self.subscription.take() { _ = cancel.send(()); } @@ -106,7 +105,7 @@ impl page::Page for Page { self.popup_setting = false; self.show_device_without_alias = false; - Command::none() + Task::none() } fn dialog(&self) -> Option> { @@ -119,12 +118,12 @@ impl page::Page for Page { "description", device = device )) - .wrap(Wrap::Word); + .wrapping(Wrapping::Word); let pin = widget::text::title1(itoa::Buffer::new().format(*passkey).to_owned()) .width(Length::Fill) - .horizontal_alignment(alignment::Horizontal::Center) - .wrap(Wrap::None); + .align_x(alignment::Horizontal::Center) + .wrapping(Wrapping::None); let control = widget::column::with_capacity(2) .push(description) @@ -193,14 +192,14 @@ impl From for crate::pages::Message { } impl Page { - pub fn update(&mut self, message: Message) -> cosmic::Command { + pub fn update(&mut self, message: Message) -> cosmic::Task { let span = tracing::span!(tracing::Level::INFO, "bluetooth::update"); let _span = span.enter(); match message { Message::Agent(message) => { let Some(message) = Arc::into_inner(message) else { - return Command::none(); + return Task::none(); }; match message { @@ -268,7 +267,7 @@ impl Page { active, )); } - let commands: Vec> = self + let tasks: Vec> = self .adapters .iter_mut() .map(|(path, adapter)| { @@ -285,7 +284,7 @@ impl Page { }) .collect(); self.update_status(); - return cosmic::command::batch(commands); + return cosmic::command::batch(tasks); } tracing::warn!("No DBus connection ready"); } @@ -413,7 +412,7 @@ impl Page { if let Some(connection) = self.connection.as_ref() { let connection = connection.clone(); if let Some((path, adapter)) = self.get_selected_adapter_mut() { - let mut fut: Vec> = vec![cosmic::command::future( + let mut fut: Vec> = vec![cosmic::command::future( get_devices(connection.clone(), path.clone()), )]; if adapter.enabled == Active::Enabled @@ -435,7 +434,7 @@ impl Page { tracing::debug!("Forgetting to device {path}"); self.popup_device = None; if self.connection.is_none() { - return cosmic::Command::none(); + return cosmic::Task::none(); } if let Some(connection) = self.connection.as_ref() { let connection = connection.clone(); @@ -450,13 +449,13 @@ impl Page { Message::ConnectDevice(path) => { tracing::debug!("Connecting device {path}"); if self.connection.is_none() { - return cosmic::Command::none(); + return cosmic::Task::none(); } if let Some(connection) = self.connection.as_ref() { let connection = connection.clone(); if let Some(device) = self.devices.get_mut(&path) { if matches!(device.enabled, Active::Enabled | Active::Enabling) { - return cosmic::Command::none(); + return cosmic::Task::none(); } device.enabled = Active::Enabling; return cosmic::command::future(connect_device(connection, path)); @@ -472,7 +471,7 @@ impl Page { let connection = connection.clone(); if let Some(device) = self.devices.get_mut(&path) { if matches!(device.enabled, Active::Disabled | Active::Disabling) { - return cosmic::Command::none(); + return cosmic::Task::none(); } device.enabled = Active::Disabling; return cosmic::command::future(disconnect_device(connection, path)); @@ -485,7 +484,7 @@ impl Page { tracing::warn!("Failed operation on device {path}"); if let Some(device) = self.devices.get_mut(&path) { if matches!(device.enabled, Active::Disabled | Active::Disabling) { - return cosmic::Command::none(); + return cosmic::Task::none(); } device.enabled = match device.enabled { Active::Disabling => Active::Enabled, @@ -499,7 +498,7 @@ impl Page { tracing::error!("dbus connection failed. {why}"); } }; - cosmic::Command::none() + cosmic::Task::none() } fn update_status(&mut self) { @@ -597,7 +596,7 @@ fn status() -> Section { } else { text::body(&descriptions[bluetooth_heading]).into() }, - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(Length::Fill).into(), if page.popup_setting { widget::popover( widget::button::icon(widget::icon::from_name( @@ -622,7 +621,7 @@ fn status() -> Section { .width(Length::Fixed(300.0)) .height(Length::Shrink) .padding([theme.space_xs(), theme.space_xxxs()]) - .style(cosmic::theme::Container::Dialog) + .class(cosmic::theme::Container::Dialog) }) .into() } else { @@ -630,7 +629,9 @@ fn status() -> Section { .on_press(Message::PopupSetting(true)) .into() }, - widget::toggler(None, status == Active::Enabled, Message::SetActive).into(), + widget::toggler(status == Active::Enabled) + .on_toggle(Message::SetActive) + .into(), ])) .apply(cosmic::Element::from) .map(crate::pages::Message::Bluetooth) @@ -641,11 +642,11 @@ fn popup_button(message: Option, text: &str) -> Element<'_, Message> { let theme = cosmic::theme::active(); let theme = theme.cosmic(); widget::text::body(text) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .apply(widget::button::custom) .padding([theme.space_xxxs(), theme.space_xs()]) .width(Length::Fill) - .style(cosmic::theme::Button::MenuItem) + .class(cosmic::theme::Button::MenuItem) .on_press_maybe(message) .into() } @@ -712,7 +713,7 @@ fn connected_devices() -> Section { ) .width(Length::Fixed(200.0)) .padding(theme.space_xxxs()) - .style(cosmic::theme::Container::Dialog) + .class(cosmic::theme::Container::Dialog) }) .into() } else { @@ -729,20 +730,22 @@ fn connected_devices() -> Section { .push(text::caption(battery)) .into() } else { - widget::text(device.alias_or_addr()).wrap(Wrap::Word).into() + widget::text(device.alias_or_addr()) + .wrapping(Wrapping::Word) + .into() }, - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(Length::Fill).into(), match device.enabled { Active::Enabled => widget::text(&descriptions[device_connected]).into(), Active::Enabling => widget::text(&descriptions[device_connecting]) - .style(cosmic::theme::Text::Color(color!(128, 128, 128))) + .class(cosmic::theme::Text::Color(color!(128, 128, 128))) .into(), Active::Disabling => widget::text(&descriptions[device_disconnecting]) - .style(cosmic::theme::Text::Color(color!(128, 128, 128))) + .class(cosmic::theme::Text::Color(color!(128, 128, 128))) .into(), Active::Disabled => widget::button::text(&descriptions[device_connect]) .on_press(Message::ConnectDevice(path.clone())) - .style(widget::button::Style::Text) + .class(widget::button::ButtonClass::Text) .into(), }, device_menu, @@ -785,14 +788,14 @@ fn available_devices() -> Section { let mut items = vec![ widget::icon::from_name(device.icon).size(16).into(), - text(device.alias_or_addr()).wrap(Wrap::Word).into(), - widget::horizontal_space(Length::Fill).into(), + text(device.alias_or_addr()).wrapping(Wrapping::Word).into(), + widget::horizontal_space().width(Length::Fill).into(), ]; if device.enabled == Active::Enabling { items.push( text(&descriptions[device_connecting]) - .style(cosmic::theme::Text::Color(color!(128, 128, 128))) + .class(cosmic::theme::Text::Color(color!(128, 128, 128))) .into(), ); } @@ -834,16 +837,16 @@ fn multiple_adapter() -> Section { widget::icon::from_name("bluetooth-symbolic") .size(20) .into(), - widget::horizontal_space(theme.space_xxs()).into(), - text(&adapter.alias).wrap(Wrap::Word).into(), - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(theme.space_xxs()).into(), + text(&adapter.alias).wrapping(Wrapping::Word).into(), + widget::horizontal_space().width(Length::Fill).into(), widget::icon::from_name("go-next-symbolic").into(), ]; if page.adapter_connected(path) { items.insert( 4, text(&descriptions[device_connected]) - .wrap(Wrap::Word) + .wrapping(Wrapping::Word) .into(), ); } diff --git a/cosmic-settings/src/pages/bluetooth/subscription.rs b/cosmic-settings/src/pages/bluetooth/subscription.rs index 2e9992a3..1a9d85e4 100644 --- a/cosmic-settings/src/pages/bluetooth/subscription.rs +++ b/cosmic-settings/src/pages/bluetooth/subscription.rs @@ -9,14 +9,14 @@ use cosmic::iced::futures::{SinkExt, StreamExt}; use futures::{channel::mpsc, stream::FusedStream}; use zbus::zvariant::OwnedObjectPath; -enum DevicePropertyWatcherCommand { +enum DevicePropertyWatcherTask { Add(OwnedObjectPath), Removed(OwnedObjectPath), } struct DevicePropertyWatcher<'a> { stream: futures::stream::SelectAll>, - rx: mpsc::Receiver, + rx: mpsc::Receiver, } struct SignalWatcher<'a> { @@ -39,7 +39,7 @@ impl<'a> futures::Stream for SignalWatcher<'a> { } impl<'a> DevicePropertyWatcher<'a> { - fn new() -> (Self, mpsc::Sender) { + fn new() -> (Self, mpsc::Sender) { let stream = futures::stream::select_all(vec![]); let (tx, rx) = mpsc::channel(10); @@ -92,7 +92,7 @@ pub async fn watch( .receive_interfaces_removed() .await?; - let (mut property_watcher, mut property_watcher_command) = DevicePropertyWatcher::new(); + let (mut property_watcher, mut property_watcher_task) = DevicePropertyWatcher::new(); for (path, interfaces) in managed_object_proxy.get_managed_objects().await? { if interfaces.contains_key("org.bluez.Device1") @@ -105,11 +105,11 @@ pub async fn watch( while !property_watcher.rx.is_terminated() { futures::select! { - command = property_watcher.rx.next() => match command { - Some(DevicePropertyWatcherCommand::Add(path)) => { + task = property_watcher.rx.next() => match task { + Some(DevicePropertyWatcherTask::Add(path)) => { property_watcher.insert(&connection, path).await?; } - Some(DevicePropertyWatcherCommand::Removed(path)) => { + Some(DevicePropertyWatcherTask::Removed(path)) => { property_watcher = property_watcher.remove(&path); } None => { @@ -144,8 +144,8 @@ pub async fn watch( Ok(device) => { match bluetooth::Device::from_device(&device).await { Ok(device) => { - property_watcher_command - .send(DevicePropertyWatcherCommand::Add(args.object_path.to_owned().into())).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; + property_watcher_task + .send(DevicePropertyWatcherTask::Add(args.object_path.to_owned().into())).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; tx .send(bluetooth::Message::AddedDevice(args.object_path.to_owned().into(), device)) @@ -170,7 +170,7 @@ pub async fn watch( Some(signal) => { let args = signal.args()?; if args.interfaces.contains(&"org.bluez.Device1") { - property_watcher_command.send(DevicePropertyWatcherCommand::Removed( + property_watcher_task.send(DevicePropertyWatcherTask::Removed( args.object_path.to_owned().into(), )).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; tx diff --git a/cosmic-settings/src/pages/desktop/appearance/font_config.rs b/cosmic-settings/src/pages/desktop/appearance/font_config.rs index e8d25df7..affe2239 100644 --- a/cosmic-settings/src/pages/desktop/appearance/font_config.rs +++ b/cosmic-settings/src/pages/desktop/appearance/font_config.rs @@ -7,11 +7,10 @@ use std::sync::Arc; use cosmic::{ config::{CosmicTk, FontConfig}, iced::Length, - iced_core::text::Wrap, - iced_style::svg::Appearance, + iced_core::text::Wrapping, theme, - widget::{self, settings}, - Apply, Command, Element, + widget::{self, settings, svg}, + Apply, Element, Task, }; use cosmic_config::ConfigSet; use ustr::Ustr; @@ -76,7 +75,7 @@ pub fn selection_context<'a>( let svg_accent = Rc::new(|theme: &cosmic::Theme| { let color = theme.cosmic().accent_color().into(); - Appearance { color: Some(color) } + svg::Style { color: Some(color) } }); let search_input = widget::search_input(fl!("type-to-search"), search) @@ -87,22 +86,24 @@ pub fn selection_context<'a>( let selected = &**family == current_font; list.add( settings::item_row(vec![ - widget::text::body(&**family).wrap(Wrap::Word).into(), - widget::horizontal_space(Length::Fill).into(), + widget::text::body(&**family) + .wrapping(Wrapping::Word) + .into(), + widget::horizontal_space().width(Length::Fill).into(), if selected { widget::icon::from_name("object-select-symbolic") .size(16) .icon() - .style(cosmic::theme::Svg::Custom(svg_accent.clone())) + .class(cosmic::theme::Svg::Custom(svg_accent.clone())) .into() } else { - widget::horizontal_space(16).into() + widget::horizontal_space().width(16).into() }, ]) .apply(widget::container) - .style(cosmic::theme::Container::List) + .class(cosmic::theme::Container::List) .apply(widget::button::custom) - .style(cosmic::theme::Button::Transparent) + .class(cosmic::theme::Button::Transparent) .on_press(super::Message::FontSelect(system, family.clone())), ) }); @@ -148,7 +149,7 @@ impl Model { } } - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::InterfaceFontFamily(id) => { if let Some(family) = self.interface_font_families.get(id) { @@ -203,7 +204,7 @@ impl Model { } } - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs b/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs index e7ba1170..a0b81764 100644 --- a/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs +++ b/cosmic-settings/src/pages/desktop/appearance/icon_themes.rs @@ -6,7 +6,6 @@ use std::{collections::BTreeMap, path::PathBuf}; use super::Message; use cosmic::{ iced::{Background, Length}, - prelude::CollectionWidget, widget::{button, icon, text}, Element, }; @@ -43,7 +42,7 @@ pub fn button( .take(ICON_PREV_ROW) .cloned() // TODO: Maybe allow choosable sizes/zooming - .map(|handle| handle.icon().size(ICON_THUMB_SIZE)), + .map(|handle| handle.icon().size(ICON_THUMB_SIZE).into()), ) .spacing(theme.space_xxxs()) .into(), @@ -54,7 +53,7 @@ pub fn button( .skip(ICON_PREV_ROW) .cloned() // TODO: Maybe allow choosable sizes/zooming - .map(|handle| handle.icon().size(ICON_THUMB_SIZE)), + .map(|handle| handle.icon().size(ICON_THUMB_SIZE).into()), ) .spacing(theme.space_xxxs()) .into(), @@ -66,9 +65,9 @@ pub fn button( .selected(selected) .padding([theme.space_xs(), theme.space_xs() + 1]) // Image button's style mostly works, but it needs a background to fit the design - .style(button::Style::Custom { + .class(button::ButtonClass::Custom { active: Box::new(move |focused, theme| { - let mut appearance = ::active( + let mut appearance = ::active( theme, focused, selected, @@ -78,7 +77,7 @@ pub fn button( appearance }), disabled: Box::new(move |theme| { - let mut appearance = ::disabled( + let mut appearance = ::disabled( theme, &cosmic::theme::Button::Image, ); @@ -86,7 +85,7 @@ pub fn button( appearance }), hovered: Box::new(move |focused, theme| { - let mut appearance = ::hovered( + let mut appearance = ::hovered( theme, focused, selected, @@ -96,7 +95,7 @@ pub fn button( appearance }), pressed: Box::new(move |focused, theme| { - let mut appearance = ::pressed( + let mut appearance = ::pressed( theme, focused, selected, diff --git a/cosmic-settings/src/pages/desktop/appearance/mod.rs b/cosmic-settings/src/pages/desktop/appearance/mod.rs index 21c0102a..aae40855 100644 --- a/cosmic-settings/src/pages/desktop/appearance/mod.rs +++ b/cosmic-settings/src/pages/desktop/appearance/mod.rs @@ -16,13 +16,13 @@ use cosmic::cosmic_theme::{ LIGHT_THEME_BUILDER_ID, }; use cosmic::iced_core::{alignment, Color, Length}; -use cosmic::iced_widget::scrollable; +use cosmic::iced_widget::scrollable::{Direction, Scrollbar}; use cosmic::widget::icon::{from_name, icon}; use cosmic::widget::{ button, color_picker::ColorPickerUpdate, container, flex_row, horizontal_space, radio, row, - settings, spin_button, text, ColorPickerModel, + scrollable, settings, spin_button, text, ColorPickerModel, }; -use cosmic::{command, Apply, Command, Element}; +use cosmic::{Apply, Element, Task}; use cosmic_panel_config::CosmicPanelConfig; use cosmic_settings_page::Section; use cosmic_settings_page::{self as page, section}; @@ -283,7 +283,7 @@ pub enum Message { ImportSuccess(Box), InterfaceText(ColorPickerUpdate), Left, - NewTheme(Theme), + NewTheme(Box), PaletteAccent(cosmic::iced::Color), Reset, Roundness(Roundness), @@ -398,8 +398,8 @@ impl Page { } #[allow(clippy::too_many_lines)] - pub fn update(&mut self, message: Message) -> Command { - let mut commands = Vec::new(); + pub fn update(&mut self, message: Message) -> Task { + let mut tasks = Vec::new(); let mut needs_build = false; let mut needs_sync = false; @@ -477,7 +477,7 @@ impl Page { } Message::NewTheme(theme) => { - self.theme = theme; + self.theme = *theme; } Message::DarkMode(enabled) => { if let Some(config) = self.theme_mode_config.as_ref() { @@ -499,25 +499,25 @@ impl Page { Message::AccentWindowHint(u) => { needs_sync = true; - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::AccentWindowHint, fl!("window-hint-accent").into(), ); - commands.push(command); - commands.push(self.accent_window_hint.update::(u)); + tasks.push(task); + tasks.push(self.accent_window_hint.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; let color = self.accent_window_hint.get_applied_color().map(Srgb::from); needs_build = self .theme_builder - .set_window_hint(config, color.clone()) + .set_window_hint(config, color) .unwrap_or_default(); } } @@ -538,7 +538,7 @@ impl Page { needs_sync = true; let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; let active_hint = match msg { @@ -563,10 +563,10 @@ impl Page { needs_sync = true; let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; - let mut gaps = self.theme_builder.gaps.clone(); + let mut gaps = self.theme_builder.gaps; gaps.1 = match msg { spin_button::Message::Increment => self.theme_builder.gaps.1.saturating_add(1), @@ -583,18 +583,18 @@ impl Page { } Message::ApplicationBackground(u) => { - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::ApplicationBackground, fl!("app-background").into(), ); - commands.push(command); - commands.push(self.application_background.update::(u)); + tasks.push(task); + tasks.push(self.application_background.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; needs_build = self @@ -610,18 +610,18 @@ impl Page { } Message::ContainerBackground(u) => { - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::ContainerBackground, fl!("container-background").into(), ); - commands.push(command); - commands.push(self.container_background.update::(u)); + tasks.push(task); + tasks.push(self.container_background.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; needs_build = self @@ -637,18 +637,18 @@ impl Page { } Message::CustomAccent(u) => { - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::CustomAccent, fl!("accent-color").into(), ); - commands.push(command); - commands.push(self.custom_accent.update::(u)); + tasks.push(task); + tasks.push(self.custom_accent.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; needs_build = self @@ -662,18 +662,18 @@ impl Page { } Message::InterfaceText(u) => { - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::InterfaceText, fl!("text-tint").into(), ); - commands.push(command); - commands.push(self.interface_text.update::(u)); + tasks.push(task); + tasks.push(self.interface_text.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; needs_build = self @@ -687,18 +687,18 @@ impl Page { } Message::ControlComponent(u) => { - let (command, needs_update) = self.update_color_picker( + let (task, needs_update) = self.update_color_picker( &u, ContextView::ControlComponent, fl!("control-tint").into(), ); - commands.push(command); - commands.push(self.control_component.update::(u)); + tasks.push(task); + tasks.push(self.control_component.update::(u)); if needs_update { let Some(config) = self.theme_builder_config.as_ref() else { - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); }; needs_build = self @@ -716,7 +716,7 @@ impl Page { self.roundness = r; let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; let radii = self.roundness.into(); @@ -743,7 +743,7 @@ impl Page { } let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; let spacing = density.into(); @@ -769,19 +769,19 @@ impl Page { self.icon_theme_active = self .icon_themes .iter() - .position(|theme| &theme.id == &active_icon_theme); + .position(|theme| theme.id == active_icon_theme); self.icon_handles = icon_handles; } Message::Left => { - commands.push(cosmic::command::message(app::Message::SetTheme( + tasks.push(cosmic::command::message(app::Message::SetTheme( cosmic::theme::system_preference(), ))); } Message::PaletteAccent(c) => { let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; needs_build = self @@ -856,7 +856,7 @@ impl Page { } Message::StartImport => { - commands.push(cosmic::command::future(async move { + tasks.push(cosmic::command::future(async move { let res = SelectedFiles::open_file() .modal(true) .filter(FileFilter::glob(FileFilter::new("ron"), "*.ron")) @@ -878,7 +878,7 @@ impl Page { let is_dark = self.theme_mode.is_dark; let name = format!("{}.ron", if is_dark { fl!("dark") } else { fl!("light") }); - commands.push(cosmic::command::future(async move { + tasks.push(cosmic::command::future(async move { let res = SelectedFiles::save_file() .modal(true) .current_name(Some(name.as_str())) @@ -904,10 +904,10 @@ impl Page { .and_then(|f| f.to_file_path().ok()); let Some(path) = path_res else { - return Command::none(); + return Task::none(); }; - commands.push(cosmic::command::future(async move { + tasks.push(cosmic::command::future(async move { let res = tokio::fs::read_to_string(path).await; if let Some(b) = res.ok().and_then(|s| ron::de::from_str(&s).ok()) { Message::ImportSuccess(Box::new(b)) @@ -927,12 +927,12 @@ impl Page { .and_then(|f| f.to_file_path().ok()); let Some(path) = path_res else { - return Command::none(); + return Task::none(); }; let theme_builder = self.theme_builder.clone(); - commands.push(cosmic::command::future(async move { + tasks.push(cosmic::command::future(async move { let Ok(builder) = ron::ser::to_string_pretty(&theme_builder, PrettyConfig::default()) else { @@ -954,7 +954,7 @@ impl Page { } // TODO: error message toast? - Message::ExportError | Message::ImportError => return Command::none(), + Message::ExportError | Message::ImportError => return Task::none(), Message::ExportSuccess => { tracing::trace!("Export successful"); @@ -987,7 +987,7 @@ impl Page { self.no_custom_window_hint = v; let Some(config) = self.theme_builder_config.as_ref() else { - return Command::none(); + return Task::none(); }; needs_build = self @@ -1042,7 +1042,7 @@ impl Page { tracing::error!("Failed to apply theme to GNOME config because the CosmicTK config does not exist."); } - return Command::none(); + return Task::none(); } Message::IconsAndToolkit => { @@ -1052,7 +1052,7 @@ impl Page { Message::Daytime(day_time) => { self.day_time = day_time; - return Command::none(); + return Task::none(); } } @@ -1062,7 +1062,7 @@ impl Page { let is_dark = self.theme_mode.is_dark; let current_theme = self.theme.clone(); - commands.push(cosmic::command::future(async move { + tasks.push(cosmic::command::future(async move { let config = if is_dark { Theme::dark_config() } else { @@ -1106,7 +1106,7 @@ impl Page { window_hint; }); - Message::NewTheme(new_theme).into() + Message::NewTheme(Box::new(new_theme)).into() } else { tracing::error!("Failed to get the theme config."); crate::app::Message::None @@ -1131,7 +1131,7 @@ impl Page { }); } - cosmic::command::batch(commands) + cosmic::Task::batch(tasks) } fn reload_theme_mode(&mut self) { @@ -1154,10 +1154,10 @@ impl Page { message: &ColorPickerUpdate, context_view: ContextView, context_title: Cow<'static, str>, - ) -> (Command, bool) { + ) -> (Task, bool) { let mut needs_update = false; - let command = match message { + let task = match message { ColorPickerUpdate::AppliedColor | ColorPickerUpdate::Reset => { needs_update = true; cosmic::command::message(crate::app::Message::CloseContextDrawer) @@ -1165,7 +1165,7 @@ impl Page { ColorPickerUpdate::ActionFinished => { needs_update = true; - Command::none() + Task::none() } ColorPickerUpdate::Cancel => { @@ -1177,10 +1177,10 @@ impl Page { cosmic::command::message(crate::app::Message::OpenContextDrawer(context_title)) } - _ => Command::none(), + _ => Task::none(), }; - (command, needs_update) + (task, needs_update) } /// Syncs changes for dark and light theme. @@ -1406,12 +1406,12 @@ impl page::Page for Page { &mut self, _: page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { - command::batch(vec![ + ) -> Task { + cosmic::command::batch(vec![ // Load icon themes - command::future(icon_themes::fetch()).map(crate::pages::Message::Appearance), + cosmic::command::future(icon_themes::fetch()).map(crate::pages::Message::Appearance), // Load font families - command::future(async move { + cosmic::command::future(async move { let (mono, interface) = font_config::load_font_families(); Message::FontConfig(font_config::Message::LoadedFonts(mono, interface)) }) @@ -1419,8 +1419,8 @@ impl page::Page for Page { ]) } - fn on_leave(&mut self) -> Command { - command::message(crate::pages::Message::Appearance(Message::Left)) + fn on_leave(&mut self) -> Task { + cosmic::command::message(crate::pages::Message::Appearance(Message::Left)) } fn context_drawer(&self) -> Option> { @@ -1552,7 +1552,7 @@ pub fn mode_and_colors() -> Section { .width(Length::Fill) .height(Length::Fixed(100.0)) ) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .padding([8, 0]) .selected(page.theme_mode.is_dark) .on_press(Message::DarkMode(true)), @@ -1560,14 +1560,14 @@ pub fn mode_and_colors() -> Section { ] .spacing(space_xxs) .width(Length::FillPortion(1)) - .align_items(cosmic::iced_core::Alignment::Center), + .align_x(cosmic::iced_core::Alignment::Center), cosmic::iced::widget::column![ button::custom( icon(light_mode_illustration.clone(),) .width(Length::Fill) .height(Length::Fixed(100.0)) ) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .selected(!page.theme_mode.is_dark) .padding([8, 0]) .on_press(Message::DarkMode(false)), @@ -1575,10 +1575,10 @@ pub fn mode_and_colors() -> Section { ] .spacing(space_xxs) .width(Length::FillPortion(1)) - .align_items(cosmic::iced_core::Alignment::Center) + .align_x(cosmic::iced_core::Alignment::Center) ] - .spacing(48) // TODO: dynamic spacing based on window width - .align_items(cosmic::iced_core::Alignment::Center) + .spacing(48) + .align_y(cosmic::iced_core::Alignment::Center) .width(Length::Fixed(424.0)), ) .width(Length::Fill) @@ -1690,9 +1690,7 @@ pub fn mode_and_colors() -> Section { .padding([0, 0, 16, 0]) .spacing(16) ) - .direction(scrollable::Direction::Horizontal( - scrollable::Properties::new() - )) + .direction(Direction::Horizontal(Scrollbar::new())) ] .padding([16, space_s, 0, space_s]) .spacing(space_xxs), @@ -1810,14 +1808,14 @@ pub fn style() -> Section { .height(Length::Fixed(100.0)) ) .selected(matches!(page.roundness, Roundness::Round)) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .padding(8) .on_press(Message::Roundness(Roundness::Round)), text::body(&descriptions[round]) ] .spacing(8) .width(Length::FillPortion(1)) - .align_items(cosmic::iced_core::Alignment::Center), + .align_x(cosmic::iced_core::Alignment::Center), cosmic::iced::widget::column![ button::custom( icon( @@ -1832,14 +1830,14 @@ pub fn style() -> Section { .height(Length::Fixed(100.0)) ) .selected(matches!(page.roundness, Roundness::SlightlyRound)) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .padding(8) .on_press(Message::Roundness(Roundness::SlightlyRound)), text::body(&descriptions[slightly_round]) ] .spacing(8) .width(Length::FillPortion(1)) - .align_items(cosmic::iced_core::Alignment::Center), + .align_x(cosmic::iced_core::Alignment::Center), cosmic::iced::widget::column![ button::custom( icon( @@ -1855,18 +1853,18 @@ pub fn style() -> Section { ) .width(Length::FillPortion(1)) .selected(matches!(page.roundness, Roundness::Square)) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .padding(8) .on_press(Message::Roundness(Roundness::Square)), text::body(&descriptions[square]) ] .spacing(8) - .align_items(cosmic::iced_core::Alignment::Center) + .align_x(cosmic::iced_core::Alignment::Center) .width(Length::FillPortion(1)) ] .spacing(12) .width(Length::Fixed(628.0)) - .align_items(cosmic::iced_core::Alignment::Center), + .align_y(cosmic::iced_core::Alignment::Center), ) .width(Length::Fill) .align_x(cosmic::iced_core::alignment::Horizontal::Center), @@ -2009,7 +2007,7 @@ pub fn reset_button() -> Section { .on_press(Message::Reset) .into() } else { - horizontal_space(1).apply(Element::from) + horizontal_space().width(1).apply(Element::from) } .map(crate::pages::Message::Appearance) }) @@ -2032,7 +2030,7 @@ pub fn color_button<'a, Message: 'a + Clone>( )) .padding(0) .selected(selected) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .on_press_maybe(on_press) .width(Length::Fixed(f32::from(width))) .height(Length::Fixed(f32::from(height))) diff --git a/cosmic-settings/src/pages/desktop/dock/applets.rs b/cosmic-settings/src/pages/desktop/dock/applets.rs index e0478468..e3cecf02 100644 --- a/cosmic-settings/src/pages/desktop/dock/applets.rs +++ b/cosmic-settings/src/pages/desktop/dock/applets.rs @@ -1,9 +1,8 @@ use cosmic::{ cosmic_config::CosmicConfigEntry, iced::{alignment, Length}, - iced_runtime::Command, widget::{button, container, row}, - Apply, Element, + Apply, Element, Task, }; use cosmic_panel_config::CosmicPanelConfig; use cosmic_settings_page::{self as page, section, Section}; @@ -14,9 +13,7 @@ use crate::{ app, pages::{ self, - desktop::panel::applets_inner::{ - self, lists, AppletsPage, ContextDrawer, ReorderWidgetState, - }, + desktop::panel::applets_inner::{self, lists, AppletsPage, ContextDrawer}, }, }; @@ -41,7 +38,7 @@ impl Default for Page { .collect(), config_helper, current_config, - reorder_widget_state: ReorderWidgetState::default(), + reorder_widget_state: None, search: String::new(), context: None, }, @@ -63,7 +60,7 @@ impl AppletsPage for Page { pub struct Message(pub applets_inner::Message); impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { self.inner.update(message.0) } } diff --git a/cosmic-settings/src/pages/desktop/dock/mod.rs b/cosmic-settings/src/pages/desktop/dock/mod.rs index dfe8b8eb..e853e541 100644 --- a/cosmic-settings/src/pages/desktop/dock/mod.rs +++ b/cosmic-settings/src/pages/desktop/dock/mod.rs @@ -4,7 +4,7 @@ use cosmic::Apply; use cosmic::{ cosmic_config::{ConfigSet, CosmicConfigEntry}, widget::{settings, text, toggler}, - Command, Element, + Element, Task, }; use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig}; use cosmic_settings_page::{self as page, section, Section}; @@ -31,19 +31,19 @@ pub enum Message { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::EnableDock(enabled) => { let Some(container_config) = self.inner.container_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some(panel_config) = self.inner.panel_config.as_ref() else { - return Command::none(); + return Task::none(); }; let Ok(helper) = CosmicPanelContainerConfig::cosmic_config() else { - return Command::none(); + return Task::none(); }; if enabled { @@ -64,7 +64,7 @@ impl Page { error!("{:?}", err); } - Command::none() + Task::none() } Message::Inner(inner) => self .inner @@ -169,13 +169,12 @@ pub(crate) fn enable() -> Section { .add(settings::item( &descriptions[dock], toggler( - None, container_config .config_list .iter() .any(|e| e.name.as_str() == "Dock"), - Message::EnableDock, - ), + ) + .on_toggle(Message::EnableDock), )) .apply(Element::from) .map(crate::pages::Message::Dock) diff --git a/cosmic-settings/src/pages/desktop/mod.rs b/cosmic-settings/src/pages/desktop/mod.rs index a6f2de2c..070afa63 100644 --- a/cosmic-settings/src/pages/desktop/mod.rs +++ b/cosmic-settings/src/pages/desktop/mod.rs @@ -2,7 +2,9 @@ // SPDX-License-Identifier: GPL-3.0-only pub mod appearance; +#[cfg(feature = "wayland")] pub mod dock; +#[cfg(feature = "wayland")] pub mod panel; pub mod wallpaper; pub mod window_management; @@ -12,14 +14,9 @@ use cosmic_settings_page as page; #[derive(Debug)] #[allow(clippy::struct_excessive_bools)] +#[derive(Default)] pub struct Page {} -impl Default for Page { - fn default() -> Self { - Self {} - } -} - impl page::Page for Page { fn info(&self) -> page::Info { page::Info::new("desktop", "video-display-symbolic").title(fl!("desktop")) @@ -28,11 +25,17 @@ impl page::Page for Page { impl page::AutoBind for Page { fn sub_pages(page: page::Insert) -> page::Insert { - page.sub_page::() - .sub_page::() - .sub_page::() - .sub_page::() - .sub_page::() + let mut page = page + .sub_page::() + .sub_page::(); + + #[cfg(feature = "wayland")] + { + page = page.sub_page::(); + page = page.sub_page::(); + } + + page.sub_page::() .sub_page::() } } diff --git a/cosmic-settings/src/pages/desktop/panel/applets_inner.rs b/cosmic-settings/src/pages/desktop/panel/applets_inner.rs index 10fcb9da..6a308f4b 100644 --- a/cosmic-settings/src/pages/desktop/panel/applets_inner.rs +++ b/cosmic-settings/src/pages/desktop/panel/applets_inner.rs @@ -1,48 +1,33 @@ -use button::StyleSheet as ButtonStyleSheet; -use cosmic::iced::alignment; -use cosmic::iced_style::container::StyleSheet; - -use cosmic::prelude::CollectionWidget; -use cosmic::widget::{ - button, column, container, horizontal_space, icon, list_column, row, text, text_input, Column, +use button::Catalog as ButtonStyleSheet; +use cosmic::iced::clipboard::dnd::{ + DndAction, DndDestinationRectangle, DndEvent, OfferEvent, SourceEvent, }; +use cosmic::iced::clipboard::mime::AsMimeTypes; +use cosmic::iced::id::Internal; +use cosmic::iced::{alignment, Vector}; + +use cosmic::iced_core; +use cosmic::widget::{button, column, container, icon, list_column, row, text, text_input, Column}; use cosmic::{ - cctk::sctk::reexports::client::protocol::wl_data_device_manager::DndAction, cosmic_config::{Config, CosmicConfigEntry}, iced::{ alignment::{Horizontal, Vertical}, - event::{ - self, - wayland::{self}, - PlatformSpecific, - }, - mouse, overlay, touch, - wayland::actions::data_device::{ActionInner, DataFromMimeType, DndIcon}, - wayland::data_device::action as data_device_action, - window, Alignment, Color, Length, Point, Rectangle, Size, + core::window, + event, mouse, overlay, touch, Alignment, Color, Length, Point, Rectangle, Size, }, - iced_runtime::{command::platform_specific, core::id::Id, Command}, - iced_widget::{ - core::{ - layout, renderer, - widget::{tree, Operation, OperationOutputWrapper, Tree}, - Clipboard, Shell, Widget, - }, - graphics::image::image_rs::EncodableLayout, + iced_runtime::{core::id::Id, Task}, + iced_widget::core::{ + layout, renderer, + widget::{tree, Operation, Tree}, + Clipboard, Shell, Widget, }, theme, Apply, Element, }; use once_cell::sync::Lazy; -use std::{ - borrow::{Borrow, Cow}, - fmt::Debug, - mem, - path::{Path, PathBuf}, - str::FromStr, - sync::Arc, -}; +use std::path::PathBuf; +use std::{borrow::Cow, fmt::Debug, mem, path::Path}; use crate::{app, pages}; use cosmic_panel_config::CosmicPanelConfig; @@ -53,12 +38,12 @@ use tracing::error; const MIME_TYPE: &str = "text/uri-list"; -pub type OnDndCommand<'a, Message> = Box< - dyn Fn( - Box platform_specific::wayland::data_device::ActionInner>, - ) -> Message - + 'a, ->; +// pub type OnDndTask<'a, Message> = Box< +// dyn Fn( +// Box platform_specific::wayland::data_device::ActionInner>, +// ) -> Message +// + 'a, +// >; // radius is 8.0 const DRAG_START_DISTANCE_SQUARED: f32 = 64.0; @@ -69,7 +54,7 @@ pub struct Page { pub(crate) available_entries: Vec>, pub(crate) config_helper: Option, pub(crate) current_config: Option, - pub(crate) reorder_widget_state: ReorderWidgetState, + pub(crate) reorder_widget_state: Option<(Applet<'static>, CosmicPanelConfig)>, pub(crate) search: String, pub(crate) context: Option, } @@ -90,7 +75,7 @@ impl Default for Page { .collect(), config_helper, current_config, - reorder_widget_state: ReorderWidgetState::default(), + reorder_widget_state: None, search: String::new(), context: None, } @@ -169,8 +154,8 @@ pub enum Message { ReorderEnd(Vec>), Applets(Vec>), PanelConfig(CosmicPanelConfig), - StartDnd(ReorderWidgetState), - DnDCommand(Arc ActionInner>>), + StartDnd(Applet<'static>), + // DnDTask(Arc ActionInner>>), Search(String), AddApplet(Applet<'static>), AddAppletDrawer, @@ -187,7 +172,7 @@ impl Debug for Message { Message::Applets(_) => write!(f, "Applets"), Message::PanelConfig(_) => write!(f, "PanelConfig"), Message::StartDnd(_) => write!(f, "StartDnd"), - Message::DnDCommand(_) => write!(f, "DnDCommand"), + // Message::DnDTask(_) => write!(f, "DnDTask"), Message::Save => write!(f, "ApplyReorder"), Message::RemoveStart(_) => write!(f, "RemoveStart"), Message::RemoveCenter(_) => write!(f, "RemoveCenter"), @@ -222,11 +207,6 @@ impl Page { } } - #[must_use] - pub fn dnd_icon(&self) -> Element { - Element::from(AppletReorderList::dnd_icon(&self.reorder_widget_state)) - } - #[must_use] #[allow(clippy::too_many_lines)] pub fn add_applet_view crate::pages::Message + Copy + 'static>( @@ -270,14 +250,15 @@ impl Page { .width(Length::Fill) .into(), button::standard(fl!("add")) - .style(button::Style::Custom { + .class(button::ButtonClass::Custom { active: Box::new(|focused, theme| { - let mut style = theme.active(focused, false, &button::Style::Text); + let mut style = + theme.active(focused, false, &button::ButtonClass::Text); style.text_color = Some(theme.cosmic().accent_color().into()); style }), disabled: Box::new(|theme| { - let mut style = theme.disabled(&button::Style::Text); + let mut style = theme.disabled(&button::ButtonClass::Text); let mut text_color: Color = theme.cosmic().accent_color().into(); text_color.a *= 0.5; style.text_color = Some(text_color); @@ -299,14 +280,14 @@ impl Page { ]) .padding([0, spacing.space_l]) .spacing(spacing.space_xs) - .align_items(Alignment::Center), + .align_y(Alignment::Center), ); } if !has_some { list_column = list_column.add( text::body(fl!("no-applets-found")) .width(Length::Fill) - .horizontal_alignment(Horizontal::Center), + .align_x(Horizontal::Center), ); } @@ -318,13 +299,13 @@ impl Page { .into(), list_column.into(), ]) - .align_items(Alignment::Center) + .align_x(Alignment::Center) .spacing(spacing.space_xxs) .into() } #[allow(clippy::too_many_lines)] - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::PanelConfig(c) => { self.current_config = Some(c); @@ -332,7 +313,7 @@ impl Page { Message::ReorderStart(start_list) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some((list, _)) = config.plugins_wings.as_mut() else { config.plugins_wings = Some(( @@ -342,13 +323,13 @@ impl Page { .collect(), Vec::new(), )); - return Command::none(); + return Task::none(); }; *list = start_list.into_iter().map(|a| a.id.into()).collect(); } Message::ReorderCenter(center_list) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some(list) = config.plugins_center.as_mut() else { config.plugins_center = Some( @@ -357,63 +338,61 @@ impl Page { .map(|a: Applet| a.id.into()) .collect(), ); - return Command::none(); + return Task::none(); }; *list = center_list.into_iter().map(|a| a.id.into()).collect(); } Message::ReorderEnd(end_list) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some((_, list)) = config.plugins_wings.as_mut() else { config.plugins_wings = Some(( Vec::new(), end_list.into_iter().map(|a: Applet| a.id.into()).collect(), )); - return Command::none(); + return Task::none(); }; *list = end_list.into_iter().map(|a| a.id.into()).collect(); } Message::Applets(applets) => { self.available_entries = applets; } - Message::StartDnd(state) => { - self.reorder_widget_state = state; - return Command::none(); - } - Message::DnDCommand(action) => { - return data_device_action(action()); + Message::StartDnd(applet) => { + self.reorder_widget_state = + Some((applet, self.current_config.clone().unwrap_or_default())); + return Task::none(); } Message::Save => { - self.reorder_widget_state = ReorderWidgetState::default(); + self.reorder_widget_state = None; self.save(); } Message::RemoveStart(to_remove) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some((list, _)) = config.plugins_wings.as_mut() else { - return Command::none(); + return Task::none(); }; list.retain(|id| id != &to_remove); self.save(); } Message::RemoveCenter(to_remove) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some(list) = config.plugins_center.as_mut() else { - return Command::none(); + return Task::none(); }; list.retain(|id| id != &to_remove); self.save(); } Message::RemoveEnd(to_remove) => { let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let Some((_, list)) = config.plugins_wings.as_mut() else { - return Command::none(); + return Task::none(); }; list.retain(|id| id != &to_remove); self.save(); @@ -422,14 +401,9 @@ impl Page { // TODO ask design team } Message::Cancel => { - self.reorder_widget_state = ReorderWidgetState::default(); - let current_config = self.config_helper.as_ref().and_then(|config_helper| { - // TODO error handling... - let panel_config = CosmicPanelConfig::get_entry(config_helper).ok()?; - // If the config is not present, it will be created with the default values and the name will not match - (panel_config.name == "Panel").then_some(panel_config) - }); - self.current_config = current_config; + if let Some((_, config)) = self.reorder_widget_state.take() { + self.current_config = Some(config); + } } Message::Search(text) => { self.search = text; @@ -437,7 +411,7 @@ impl Page { Message::AddApplet(applet) => { // TODO ask design team let Some(config) = self.current_config.as_mut() else { - return Command::none(); + return Task::none(); }; let list = if let Some((list, _)) = config.plugins_wings.as_mut() { list @@ -456,7 +430,7 @@ impl Page { )))); } }; - Command::none() + Task::none() } } @@ -493,15 +467,14 @@ pub fn lists< .collect() }) .unwrap_or_default(), - Some((window::Id::MAIN, *APPLET_DND_ICON_ID)), Message::StartDnd, - |a| Message::DnDCommand(Arc::new(a)), + // |a| Message::DnDTask(Arc::new(a)), Message::RemoveStart, Message::DetailStart, Message::ReorderStart, Message::Save, Message::Cancel, - page.reorder_widget_state.dragged_applet().as_ref(), + page.reorder_widget_state.as_ref().map(|(a, _)| a.clone()), ) .into(), ]) @@ -524,15 +497,14 @@ pub fn lists< .collect() }) .unwrap_or_default(), - Some((window::Id::MAIN, *APPLET_DND_ICON_ID)), Message::StartDnd, - |a| Message::DnDCommand(Arc::new(a)), + // |a| Message::DnDTask(Arc::new(a)), Message::RemoveCenter, Message::DetailCenter, Message::ReorderCenter, Message::Save, Message::Cancel, - page.reorder_widget_state.dragged_applet().as_ref(), + page.reorder_widget_state.as_ref().map(|(a, _)| a.clone()), ) .into(), ]) @@ -556,15 +528,14 @@ pub fn lists< .collect() }) .unwrap_or_default(), - Some((window::Id::MAIN, *APPLET_DND_ICON_ID)), Message::StartDnd, - |a| Message::DnDCommand(Arc::new(a)), + // |a| Message::DnDTask(Arc::new(a)), Message::RemoveEnd, Message::DetailEnd, Message::ReorderEnd, Message::Save, Message::Cancel, - page.reorder_widget_state.dragged_applet().as_ref(), + page.reorder_widget_state.as_ref().map(|(a, _)| a.clone()), ) .into(), ]) @@ -643,13 +614,13 @@ impl<'a> Applet<'a> { pub struct AppletReorderList<'a, Message> { id: Id, info: Vec>, - on_create_dnd_source: Box Message + 'a>, - on_dnd_command_produced: OnDndCommand<'a, Message>, + on_create_dnd_source: Box) -> Message + 'a>, + // on_dnd_task_produced: OnDndTask<'a, Message>, on_reorder: Box>) -> Message + 'a>, on_finish: Option, on_cancel: Option, - surface_ids: Option<(window::Id, window::Id)>, inner: Element<'a, Message>, + active_applet_offer: Option>, } impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { @@ -658,18 +629,13 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { /// new applet list which can be reordered and dragged pub fn new( info: Vec>, - surface_ids: Option<(window::Id, window::Id)>, - on_create_dnd_source: impl Fn(ReorderWidgetState) -> Message + 'a, - on_dnd_command_produced: impl Fn( - Box platform_specific::wayland::data_device::ActionInner>, - ) -> Message - + 'a, + on_create_dnd_source: impl Fn(Applet<'static>) -> Message + 'a, on_remove: impl Fn(String) -> Message + 'a, - on_details: impl Fn(String) -> Message + 'a, + _on_details: impl Fn(String) -> Message + 'a, on_reorder: impl Fn(Vec>) -> Message + 'a, on_apply_reorder: Message, on_cancel: Message, - active_dnd: Option<&Applet<'a>>, + active_dnd: Option>, ) -> Self { let spacing = cosmic::theme::active().cosmic().spacing; let applet_buttons = info @@ -701,12 +667,12 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { .into(), ]) .spacing(spacing.space_xs) - .align_items(Alignment::Center), + .align_y(Alignment::Center), ) .width(Length::Fill) .padding(8) - .style(theme::Container::Custom(Box::new(move |theme| { - let mut style = theme.appearance(&theme::Container::Primary); + .class(theme::Container::Custom(Box::new(move |theme| { + let mut style = container::Catalog::style(theme, &theme::Container::Primary); style.border.radius = 8.0.into(); if is_dragged { style.border.color = theme.cosmic().accent_color().into(); @@ -722,24 +688,23 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { id: Id::unique(), info, on_create_dnd_source: Box::new(on_create_dnd_source), - on_dnd_command_produced: Box::new(on_dnd_command_produced), + // on_dnd_task_produced: Box::new(on_dnd_task_produced), on_reorder: Box::new(on_reorder), on_finish: Some(on_apply_reorder), on_cancel: Some(on_cancel), - surface_ids, inner: if active_dnd.is_some() && applet_buttons.is_empty() { container( text::body(fl!("drop-here")) .width(Length::Fill) .height(Length::Fill) - .vertical_alignment(Vertical::Center) - .horizontal_alignment(Horizontal::Center), + .align_y(Vertical::Center) + .align_x(Horizontal::Center), ) .width(Length::Fill) .height(Length::Fixed(48.0)) .padding(8) - .style(theme::Container::Custom(Box::new(move |theme| { - let mut style = theme.appearance(&theme::Container::Primary); + .class(theme::Container::Custom(Box::new(move |theme| { + let mut style = container::Catalog::style(theme, &theme::Container::Primary); style.border.radius = 8.0.into(); style.border.color = theme.cosmic().bg_divider().into(); style.border.width = 2.0; @@ -752,53 +717,7 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { .spacing(spacing.space_xxs) .into() }, - } - } - - #[must_use] - /// mark this as a dnd icon - pub fn dnd_icon(state: &'a ReorderWidgetState) -> Self { - Self { - id: Id::unique(), - info: Vec::new(), - on_create_dnd_source: Box::new(|_| unimplemented!()), - on_dnd_command_produced: Box::new(|_| unimplemented!()), - on_reorder: Box::new(|_| unimplemented!()), - on_finish: None, - surface_ids: None, - inner: if let Some(info) = state.dragged_applet() { - container( - row::with_children(vec![ - icon::from_name("grip-lines-symbolic") - .size(16) - .symbolic(true) - .into(), - icon::from_name(info.icon.into_owned()).size(32).into(), - column::with_capacity(2) - .spacing(4.0) - .width(Length::Fill) - .push(text::body(info.name)) - .push(text::caption(info.description)) - .into(), - button::icon(icon::from_name("edit-delete-symbolic")) - .extra_small() - .into(), - ]) - .spacing(12) - .align_items(Alignment::Center), - ) - .width(Length::Fixed(state.layout.map_or(400.0, |l| l.width))) - .padding(8) - .style(theme::Container::Custom(Box::new(move |theme| { - let mut style = theme.appearance(&theme::Container::Primary); - style.border.radius = 8.0.into(); - style - }))) - .into() - } else { - horizontal_space(1).into() - }, - on_cancel: None, + active_applet_offer: active_dnd, } } @@ -867,6 +786,61 @@ impl<'a, Message: 'static + Clone> AppletReorderList<'a, Message> { reordered } + + /// Returns the drag id of the destination. + /// + /// # Panics + /// Panics if the destination has been assigned a Set id, which is invalid. + #[must_use] + pub fn get_drag_id(&self) -> u128 { + match &self.id.0 { + Internal::Unique(id) | Internal::Custom(id, _) => *id as u128, + Internal::Set(_) => panic!("Invalid Id assigned to dnd destination."), + } + } +} + +#[must_use] +/// mark this as a dnd icon +pub fn dnd_icon(info: Applet<'static>, layout: &layout::Layout) -> AppletReorderList<'static, ()> { + AppletReorderList::<'static, ()> { + id: Id::unique(), + info: Vec::new(), + on_create_dnd_source: Box::new(|_| unimplemented!()), + // on_dnd_task_produced: Box::new(|_| unimplemented!()), + on_reorder: Box::new(|_| unimplemented!()), + on_finish: None, + inner: container( + row::with_children(vec![ + icon::from_name("grip-lines-symbolic") + .size(16) + .symbolic(true) + .into(), + icon::from_name(info.icon.into_owned()).size(32).into(), + column::with_capacity(2) + .spacing(4.0) + .width(Length::Fill) + .push(text::body(info.name)) + .push(text::caption(info.description)) + .into(), + button::icon(icon::from_name("edit-delete-symbolic")) + .extra_small() + .into(), + ]) + .spacing(12) + .align_y(Alignment::Center), + ) + .width(Length::Fixed(layout.bounds().width)) + .padding(8) + .class(theme::Container::Custom(Box::new(move |theme| { + let mut style = container::Catalog::style(theme, &theme::Container::Primary); + style.border.radius = 8.0.into(); + style + }))) + .into(), + on_cancel: None, + active_applet_offer: None, + } } impl<'a, Message: 'static> Widget @@ -912,8 +886,12 @@ where tree: &mut Tree, layout: layout::Layout<'_>, renderer: &cosmic::Renderer, - operation: &mut dyn Operation>, + operation: &mut dyn Operation<()>, ) { + let state = tree.state.downcast_mut::(); + + operation.custom(state, Some(&self.id)); + self.inner.as_widget().operate( &mut tree.children[0], layout.children().next().unwrap(), @@ -954,294 +932,124 @@ where / self.info.len() as f32; let state = tree.state.downcast_mut::(); - state.dragging_state = match mem::take(&mut state.dragging_state) { - DraggingState::None => { - // if no dragging state, listen for press events - match &event { - event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) - | event::Event::Touch(touch::Event::FingerPressed { .. }) - if cursor_position.is_over(layout.bounds()) => - { - ret = event::Status::Captured; + state.dragging_state = { + match mem::take(&mut state.dragging_state) { + DraggingState::Dragging(applet) => match &event { + event::Event::Dnd(DndEvent::Source(source_event)) => match source_event { + SourceEvent::Cancelled => { + ret = event::Status::Captured; + if let Some(on_cancel) = self.on_cancel.clone() { + shell.publish(on_cancel); + } + DraggingState::None + } + SourceEvent::Finished => { + ret = event::Status::Captured; - DraggingState::Pressed(cursor_position.position().unwrap_or_default()) - } - _ => DraggingState::None, - } - } - DraggingState::Dragging(applet) => match &event { - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DataSource(wayland::DataSourceEvent::DndFinished), - )) => { - ret = event::Status::Captured; - DraggingState::None - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DataSource(wayland::DataSourceEvent::Cancelled), - )) => { - ret = event::Status::Captured; - if let Some(on_cancel) = self.on_cancel.clone() { - shell.publish(on_cancel); + DraggingState::None + } + _ => DraggingState::Dragging(applet), + }, + _ => DraggingState::Dragging(applet), + }, + DraggingState::None => { + // if no dragging state, listen for press events + match &event { + event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) + | event::Event::Touch(touch::Event::FingerPressed { .. }) + if cursor_position.is_over(layout.bounds()) => + { + ret = event::Status::Captured; + + DraggingState::Pressed(cursor_position.position().unwrap_or_default()) + } + _ => DraggingState::None, } - DraggingState::None - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DataSource(wayland::DataSourceEvent::DndDropPerformed), - )) => { - ret = event::Status::Captured; - - DraggingState::None } - _ => DraggingState::Dragging(applet), - }, - DraggingState::Pressed(start) => { - // if dragging state is pressed, listen for motion events or release events - match &event { - event::Event::Mouse(mouse::Event::CursorMoved { .. }) - | event::Event::Touch(touch::Event::FingerMoved { .. }) => { - let pos = cursor_position.position().unwrap_or_default(); - let d_y = pos.y - start.y; - let d_x = pos.x - start.x; - let distance_squared = d_y * d_y + d_x * d_x; - - if distance_squared > DRAG_START_DISTANCE_SQUARED { - if let Some((_, applet)) = - self.info.iter().enumerate().find(|(i, _)| { - start.y - < layout.bounds().y - + (*i + 1) as f32 * (height + spacing.space_xxs as f32) - }) - { - let (window_id, icon_id) = self.surface_ids.unwrap(); - state.dragging_state = - DraggingState::Dragging(applet.clone().into_owned()); - - // TODO emit a dnd command - state.layout = Some(layout.bounds().size()); - let state_clone = state.clone(); - shell.publish((self.on_create_dnd_source.as_ref())( - state_clone.clone(), - )); - - let p = applet.path.to_path_buf(); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new(move || { - platform_specific::wayland::data_device::ActionInner::StartDnd { - mime_types: vec![MIME_TYPE.to_string()], - actions: DndAction::Move, - origin_id: window_id, - icon_id: Some(( - DndIcon::Widget( - icon_id, - Box::new(state_clone.clone()), - ), - cosmic::iced::Vector::ZERO + DraggingState::Pressed(start) => { + // if dragging state is pressed, listen for motion events or release events + match &event { + event::Event::Mouse(mouse::Event::CursorMoved { .. }) + | event::Event::Touch(touch::Event::FingerMoved { .. }) => { + let pos = cursor_position.position().unwrap_or_default(); + let d_y = pos.y - start.y; + let d_x = pos.x - start.x; + let distance_squared = d_y * d_y + d_x * d_x; + + if distance_squared > DRAG_START_DISTANCE_SQUARED { + if let Some((_, applet)) = + self.info.iter().enumerate().find(|(i, _)| { + start.y + < layout.bounds().y + + (*i + 1) as f32 + * (height + spacing.space_xxs as f32) + }) + { + let applet = applet.clone().into_owned(); + state.dragging_state = DraggingState::Dragging(applet.clone()); + + state.layout = Some(layout.bounds().size()); + shell.publish((self.on_create_dnd_source.as_ref())( + applet.clone(), + )); + + let p = applet.path.to_path_buf(); + iced_core::clipboard::start_dnd::< + cosmic::Theme, + cosmic::Renderer, + (), + >( + clipboard, + false, + Some(iced_core::clipboard::DndSource::Widget( + self.id.clone(), + )), + Some(( + dnd_icon(applet.clone(), &layout).into(), + iced_core::widget::tree::State::new(state.clone()), )), - data: Box::new(AppletString(p.clone())), - } - }))); - ret = event::Status::Captured; - DraggingState::Dragging(applet.clone().into_owned()) + Box::new(AppletString(p.clone())), + DndAction::Move, + ); + ret = event::Status::Captured; + let reordered = self + .info + .iter() + .filter(|a| { + applet != **a + }) + .cloned() + .map(pages::desktop::panel::applets_inner::Applet::into_owned) + .collect(); + shell.publish((self.on_reorder.as_ref())(reordered)); + DraggingState::Dragging(applet.clone().into_owned()) + } else { + DraggingState::Pressed(start) + } } else { DraggingState::Pressed(start) } - } else { - DraggingState::Pressed(start) } + event::Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) + | event::Event::Touch( + touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }, + ) => { + ret = event::Status::Captured; + DraggingState::None + } + _ => DraggingState::Pressed(start), } - event::Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) - | event::Event::Touch( - touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }, - ) => { - ret = event::Status::Captured; - DraggingState::None - } - _ => DraggingState::Pressed(start), } } }; + state.dnd_offer = match mem::take(&mut state.dnd_offer) { DndOfferState::None => match &event { - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::SourceActions(actions)), - )) => DndOfferState::OutsideWidget(Vec::new(), *actions, None), - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::Enter { x, y, mime_types }), - )) => { - if mime_types.iter().any(|m| m.as_str() == MIME_TYPE) { - let point = Point::new(*x as f32, *y as f32); - - if layout.bounds().contains(point) { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: DndAction::Move, - accepted: DndAction::Move, - } - }, - ))); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::Accept( - Some(MIME_TYPE.to_string()), - ) - }, - ))); - let data = if let DraggingState::Dragging(a) = &state.dragging_state { - Some(a.clone()) - } else { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::RequestDndData( - MIME_TYPE.to_string(), - ) - }, - ))); - None - }; - DndOfferState::HandlingOffer( - mime_types.clone(), - DndAction::empty(), - data, - ) - } else { - let data = match &state.dragging_state { - DraggingState::Dragging(data) => { - let filtered: Vec<_> = self - .info - .clone() - .into_iter() - .filter(|a| a != data) - .collect(); - if filtered != self.info { - shell.publish((self.on_reorder.as_ref())( - filtered - .into_iter() - .map(pages::desktop::panel::applets_inner::Applet::into_owned) - .collect(), - )); - } - Some(data.clone()) - } - _ => None, - }; - DndOfferState::OutsideWidget( - mime_types.clone(), - DndAction::empty(), - data, - ) - } - } else { - DndOfferState::None - } - } - _ => DndOfferState::None, - }, - DndOfferState::OutsideWidget(mime_types, action, data) => match &event { - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::SourceActions(actions)), - )) => DndOfferState::OutsideWidget(mime_types, *actions, data), - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::Motion { x, y }), - )) => { - let point = Point::new(*x as f32, *y as f32); - - if layout.bounds().contains(point) { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: DndAction::Move, - accepted: DndAction::Move, - } - }, - ))); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::Accept(Some( - MIME_TYPE.to_string(), - )) - }, - ))); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: action.intersection(DndAction::Move), - accepted: action - .intersection(DndAction::Move.union(DndAction::Copy)), - } - }, - ))); - // TODO maybe keep track of data and request here if we don't have it - // also maybe just refactor DND Targets to allow easier handling... - - if data.is_none() { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::RequestDndData( - MIME_TYPE.to_string(), - ) - }, - ))); - } - if let Some(applet) = data.clone() { - let reordered_list: Vec<_> = self.get_reordered( - &layout, - Point { - x: *x as f32, - y: *y as f32, - }, - applet, - ); - if reordered_list != self.info { - shell.publish((self.on_reorder.as_ref())( - reordered_list.into_iter().map(Applet::into_owned).collect(), - )); - } - } - - DndOfferState::HandlingOffer(mime_types, DndAction::empty(), data) - } else { - DndOfferState::OutsideWidget(mime_types, DndAction::empty(), data) - } - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::DndData { - data: new_data, - mime_type, - }), - )) => { - if mime_type.as_str() == MIME_TYPE { - let data = std::str::from_utf8(new_data.as_bytes()) - .ok() - .and_then(|s| url::Url::from_str(s).ok()) - .and_then(|url| url.to_file_path().ok()) - .and_then(|p| Applet::try_from(Cow::from(p)).ok()); - DndOfferState::OutsideWidget(mime_types, action, data) - } else { - DndOfferState::OutsideWidget(mime_types, action, data) - } - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer( - wayland::DndOfferEvent::DropPerformed | wayland::DndOfferEvent::Leave, - ), - )) => DndOfferState::None, - _ => DndOfferState::OutsideWidget(mime_types, action, data), - }, - DndOfferState::HandlingOffer(mime_types, action, data) => match &event { - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::Motion { x, y }), - )) => { - let point = Point::new(*x as f32, *y as f32); - if layout.bounds().contains(point) { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: DndAction::Move, - accepted: DndAction::Move, - } - }, - ))); - if let Some(data) = data.clone() { + event::Event::Dnd(dnd_event) => match dnd_event { + DndEvent::Offer(rectangle, OfferEvent::Enter { x, y, .. }) + if *rectangle == Some(self.get_drag_id()) => + { + if let Some(data) = self.active_applet_offer.clone() { let reordered_list = self.get_reordered( &layout, Point { @@ -1259,130 +1067,69 @@ where )); } } - DndOfferState::HandlingOffer(mime_types, DndAction::empty(), data) - } else { - if let Some(applet) = data.clone() { - let reordered_list: Vec<_> = self.get_reordered( + DndOfferState::HandlingOffer + } + _ => DndOfferState::None, + }, + _ => DndOfferState::None, + }, + DndOfferState::HandlingOffer => match &event { + event::Event::Dnd(dnd_event) => match dnd_event { + DndEvent::Offer(rectangle, OfferEvent::Motion { x, y }) + if *rectangle == Some(self.get_drag_id()) => + { + if let Some(data) = self.active_applet_offer.clone() { + let reordered_list = self.get_reordered( &layout, Point { x: *x as f32, y: *y as f32, }, - applet, + data, ); if reordered_list != self.info { shell.publish((self.on_reorder.as_ref())( - reordered_list.into_iter().map(Applet::into_owned).collect(), - )); - } - } - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::Accept(None) - }, - ))); - DndOfferState::OutsideWidget(mime_types, DndAction::empty(), data) - } - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::Leave), - )) => DndOfferState::None, - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::SourceActions(actions)), - )) => { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: DndAction::Move, - accepted: DndAction::Move, - }, - ))); - DndOfferState::HandlingOffer(mime_types, *actions, data) - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::DndData { - data: new_data, - mime_type, - }), - )) => { - if mime_type.as_str() == MIME_TYPE { - let data = std::str::from_utf8(new_data.as_bytes()) - .ok() - .and_then(|s| url::Url::from_str(s).ok()) - .and_then(|url| url.to_file_path().ok()) - .and_then(|p| Applet::try_from(Cow::from(p)).ok()); - if let Some(data) = data.borrow() { - let filtered: Vec<_> = self - .info - .clone() - .into_iter() - .filter(|a| a != data) - .collect(); - if filtered != self.info { - shell.publish((self.on_reorder.as_ref())( - filtered + reordered_list .into_iter() .map(pages::desktop::panel::applets_inner::Applet::into_owned) .collect(), )); } } - - DndOfferState::HandlingOffer(mime_types, action, data) - } else { - DndOfferState::HandlingOffer(mime_types, action, data) - } - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::DropPerformed), - )) => { - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || platform_specific::wayland::data_device::ActionInner::SetActions { - preferred: DndAction::Move, - accepted: DndAction::Move, - }, - ))); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::Accept(Some( - MIME_TYPE.to_string(), - )) - }, - ))); - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || { - platform_specific::wayland::data_device::ActionInner::RequestDndData( - MIME_TYPE.to_string(), - ) - }, - ))); - DndOfferState::Dropped - } - _ => DndOfferState::HandlingOffer(mime_types, action, data), - }, - DndOfferState::Dropped => match &event { - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::DndData { .. }), - )) => { - if let Some(on_finish) = self.on_finish.clone() { - shell.publish(on_finish); + DndOfferState::HandlingOffer } - shell.publish((self.on_dnd_command_produced.as_ref())(Box::new( - move || platform_specific::wayland::data_device::ActionInner::DndFinished, - ))); + DndEvent::Offer( + rectangle, + OfferEvent::LeaveDestination | OfferEvent::Leave, + ) if *rectangle == Some(self.get_drag_id()) => { + let reordered = self + .info + .iter() + .filter(|a| { + !self + .active_applet_offer + .as_ref() + .is_some_and(|offer| offer == *a) + }) + .cloned() + .map(pages::desktop::panel::applets_inner::Applet::into_owned) + .collect(); + shell.publish((self.on_reorder.as_ref())(reordered)); - DndOfferState::None - } - event::Event::PlatformSpecific(PlatformSpecific::Wayland( - wayland::Event::DndOffer(wayland::DndOfferEvent::Leave), - )) => { - // already applied the offer, so we can just finish - if let Some(on_cancel) = self.on_cancel.clone() { - shell.publish(on_cancel); + DndOfferState::None } + DndEvent::Offer(rectangle, OfferEvent::Data { .. }) + if *rectangle == Some(self.get_drag_id()) => + { + if let Some(on_finish) = self.on_finish.clone() { + shell.publish(on_finish); + } - DndOfferState::None - } - _ => DndOfferState::Dropped, + DndOfferState::None + } + _ => DndOfferState::HandlingOffer, + }, + _ => DndOfferState::HandlingOffer, }, }; @@ -1415,11 +1162,13 @@ where tree: &'b mut Tree, layout: layout::Layout<'_>, renderer: &cosmic::Renderer, + translation: Vector, ) -> Option> { self.inner.as_widget_mut().overlay( &mut tree.children[0], layout.children().next().unwrap(), renderer, + translation, ) } @@ -1451,28 +1200,65 @@ where interaction => interaction, } } + + fn id(&self) -> Option { + Some(self.id.clone()) + } + + fn set_id(&mut self, id: Id) { + self.id = id; + } + + fn drag_destinations( + &self, + _state: &Tree, + layout: layout::Layout<'_>, + _renderer: &cosmic::Renderer, + dnd_rectangles: &mut cosmic::iced_core::clipboard::DndDestinationRectangles, + ) { + let Rectangle { + x, + y, + width, + height, + } = layout.bounds(); + dnd_rectangles.push(DndDestinationRectangle { + id: self.get_drag_id(), + rectangle: cosmic::iced::clipboard::dnd::Rectangle { + x: x as f64, + y: y as f64, + width: width as f64, + height: height as f64, + }, + mime_types: vec![Cow::Owned(MIME_TYPE.to_string())], + actions: DndAction::Move, + preferred: DndAction::Move, + }); + } } -/// A string which can be sent to the clipboard or drag-and-dropped. -#[derive(Debug, Clone)] -pub struct AppletString(PathBuf); +impl AsMimeTypes for AppletString { + fn available(&self) -> Cow<'static, [String]> { + Cow::Owned(vec![MIME_TYPE.to_string()]) + } -impl DataFromMimeType for AppletString { - fn from_mime_type(&self, mime_type: &str) -> Option> { + fn as_bytes(&self, mime_type: &str) -> Option> { if mime_type == MIME_TYPE { - let data = Some( + Some(Cow::Owned( url::Url::from_file_path(self.0.clone()) .ok()? .to_string() .as_bytes() .to_vec(), - ); - data + )) } else { None } } } +/// A string which can be sent to the clipboard or drag-and-dropped. +#[derive(Debug, Clone)] +pub struct AppletString(PathBuf); #[derive(Debug, Default, Clone)] pub enum DraggingState { @@ -1489,9 +1275,7 @@ pub enum DraggingState { pub(crate) enum DndOfferState { #[default] None, - OutsideWidget(Vec, DndAction, Option>), - HandlingOffer(Vec, DndAction, Option>), - Dropped, + HandlingOffer, } #[derive(Debug, Default, Clone)] @@ -1505,13 +1289,6 @@ impl ReorderWidgetState { pub(crate) fn new() -> ReorderWidgetState { ReorderWidgetState::default() } - - pub(crate) fn dragged_applet(&self) -> Option> { - match &self.dragging_state { - DraggingState::Dragging(applet) => Some(applet.borrowed()), - _ => None, - } - } } impl<'a, Message: 'static + Clone> From> for Element<'a, Message> { diff --git a/cosmic-settings/src/pages/desktop/panel/inner.rs b/cosmic-settings/src/pages/desktop/panel/inner.rs index 2fd68464..121572cc 100644 --- a/cosmic-settings/src/pages/desktop/panel/inner.rs +++ b/cosmic-settings/src/pages/desktop/panel/inner.rs @@ -6,7 +6,7 @@ use cosmic::{ widget::{ button, container, dropdown, horizontal_space, icon, row, settings, slider, text, toggler, }, - Command, Element, + Element, Task, }; use cosmic::Apply; @@ -118,11 +118,7 @@ pub(crate) fn behavior_and_position< .title(§ion.title) .add(settings::item( &descriptions[autohide_label], - toggler( - None, - panel_config.autohide.is_some(), - Message::AutoHidePanel, - ), + toggler(panel_config.autohide.is_some()).on_toggle(Message::AutoHidePanel), )) .add(settings::item( &descriptions[position], @@ -177,11 +173,11 @@ pub(crate) fn style< .title(§ion.title) .add(settings::item( &descriptions[gap_label], - toggler(None, panel_config.anchor_gap, Message::AnchorGap), + toggler(panel_config.anchor_gap).on_toggle(Message::AnchorGap), )) .add(settings::item( &descriptions[extend_label], - toggler(None, panel_config.expand_to_edges, Message::ExtendToEdge), + toggler(panel_config.expand_to_edges).on_toggle(Message::ExtendToEdge), )) .add(settings::item( &descriptions[appearance], @@ -272,7 +268,7 @@ pub(crate) fn configuration + PanelPage>( .find(|(_, v)| v.id == page.applets_page_id()) { let control = row::with_children(vec![ - horizontal_space(Length::Fill).into(), + horizontal_space().width(Length::Fill).into(), icon::from_name("go-next-symbolic").size(16).into(), ]); @@ -281,9 +277,9 @@ pub(crate) fn configuration + PanelPage>( .control(control) .spacing(16) .apply(container) - .style(theme::Container::List) + .class(theme::Container::List) .apply(button::custom) - .style(theme::Button::Transparent) + .class(theme::Button::Transparent) .on_press(crate::pages::Message::Page(panel_applets_entity)), ) } else { @@ -334,7 +330,7 @@ pub fn reset_button< let descriptions = §ion.descriptions; let inner = page.inner(); if inner.system_default == inner.panel_config { - Element::from(horizontal_space(1)) + Element::from(horizontal_space().width(1)) } else { button::standard(&descriptions[reset_to_default]) .on_press(Message::ResetPanel) @@ -347,14 +343,18 @@ pub fn reset_button< #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct Anchor(PanelAnchor); -impl ToString for Anchor { - fn to_string(&self) -> String { - match self.0 { - PanelAnchor::Top => fl!("panel-top"), - PanelAnchor::Bottom => fl!("panel-bottom"), - PanelAnchor::Left => fl!("panel-left"), - PanelAnchor::Right => fl!("panel-right"), - } +impl std::fmt::Display for Anchor { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self.0 { + PanelAnchor::Top => fl!("panel-top"), + PanelAnchor::Bottom => fl!("panel-bottom"), + PanelAnchor::Left => fl!("panel-left"), + PanelAnchor::Right => fl!("panel-right"), + } + ) } } @@ -365,13 +365,17 @@ pub enum Appearance { Dark, } -impl ToString for Appearance { - fn to_string(&self) -> String { - match self { - Appearance::Match => fl!("panel-appearance", "match"), - Appearance::Light => fl!("panel-appearance", "light"), - Appearance::Dark => fl!("panel-appearance", "dark"), - } +impl std::fmt::Display for Appearance { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Appearance::Match => fl!("panel-appearance", "match"), + Appearance::Light => fl!("panel-appearance", "light"), + Appearance::Dark => fl!("panel-appearance", "dark"), + } + ) } } @@ -418,9 +422,9 @@ pub enum Message { impl PageInner { #[allow(clippy::too_many_lines)] - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { let Some(helper) = self.config_helper.as_ref() else { - return Command::none(); + return Task::none(); }; match &message { @@ -458,7 +462,7 @@ impl PageInner { }; let Some(panel_config) = self.panel_config.as_mut() else { - return Command::none(); + return Task::none(); }; match message { @@ -526,11 +530,11 @@ impl PageInner { panel_config.opacity = opacity; if self.opacity_changing { - return Command::none(); + return Task::none(); } self.opacity_changing = true; - return cosmic::command::future(async move { + return cosmic::Task::future(async move { tokio::time::sleep(Duration::from_millis(125)).await; Message::OpacityApply }); @@ -544,7 +548,7 @@ impl PageInner { Message::OutputAdded(name, output) => { self.outputs.push(name.clone()); self.outputs_map.insert(output.id(), (name, output)); - return Command::none(); + return Task::none(); } Message::OutputRemoved(output) => { if let Some((name, _)) = self.outputs_map.remove(&output.id()) { @@ -555,7 +559,7 @@ impl PageInner { } Message::PanelConfig(c) => { self.panel_config = Some(c); - return Command::none(); + return Task::none(); } Message::ResetPanel | Message::FullReset => {} } @@ -570,6 +574,6 @@ impl PageInner { _ = panel_config.set_border_radius(helper, 0); } - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/desktop/panel/mod.rs b/cosmic-settings/src/pages/desktop/panel/mod.rs index 24475146..f1829655 100644 --- a/cosmic-settings/src/pages/desktop/panel/mod.rs +++ b/cosmic-settings/src/pages/desktop/panel/mod.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use cosmic::{cosmic_config::CosmicConfigEntry, Command}; +use cosmic::{cosmic_config::CosmicConfigEntry, Task}; use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfig}; use cosmic_settings_page::{self as page, section, Section}; use slotmap::SlotMap; @@ -22,7 +22,7 @@ pub struct Page { pub struct Message(pub inner::Message); impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { self.inner .update(message.0) .map(Message) diff --git a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs index e2f385ed..88165d25 100644 --- a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs +++ b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs @@ -14,7 +14,7 @@ use std::{ sync::Arc, }; -use cosmic::{command, Apply, Command}; +use cosmic::iced::{Color, Length}; use cosmic::{ dialog::file_chooser, widget::{ @@ -23,16 +23,13 @@ use cosmic::{ settings, tab_bar, text, toggler, }, }; -use cosmic::{ - iced::{Color, Length}, - prelude::CollectionWidget, -}; use cosmic::{iced_core::alignment, iced_runtime::core::image::Handle as ImageHandle}; use cosmic::{iced_core::Alignment, widget::icon}; use cosmic::{ widget::{color_picker::ColorPickerUpdate, ColorPickerModel}, Element, }; +use cosmic::{Apply, Task}; use cosmic_bg_config::Source; use cosmic_settings_page::Section; use cosmic_settings_page::{self as page, section}; @@ -208,12 +205,12 @@ impl page::Page for Page { &mut self, _page: page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { let current_folder = self.config.current_folder().to_owned(); let recurse = self.categories.selected == Some(Category::Wallpapers); - command::future(async move { + Task::future(async move { let (service_config, displays) = wallpaper::config().await; let mut selection = change_folder(current_folder, recurse).await; @@ -418,7 +415,7 @@ impl Page { _ => return, }; - self.cached_display_handle = Some(ImageHandle::from_pixels( + self.cached_display_handle = Some(ImageHandle::from_rgba( image.width(), image.height(), image.to_vec(), @@ -545,14 +542,14 @@ impl Page { } /// Changes the selection category, such as wallpaper select or color select. - fn change_category(&mut self, category: Category) -> Command { - let mut command = Command::none(); + fn change_category(&mut self, category: Category) -> Task { + let mut task = Task::none(); match category { Category::Wallpapers => { if self.config.current_folder.is_some() { let _ = self.config.set_current_folder(None); - command = cosmic::command::future(async move { + task = cosmic::command::future(async move { let folder = change_folder(Config::default_folder().to_owned(), true).await; Message::ChangeFolder(folder) }); @@ -572,7 +569,7 @@ impl Page { tracing::error!(?path, ?why, "failed to set current folder"); } - command = cosmic::command::future(async move { + task = cosmic::command::future(async move { Message::ChangeFolder(change_folder(path, false).await) }); } @@ -596,7 +593,7 @@ impl Page { } self.categories.selected = Some(category); - command + task } /// Changes the output being configured @@ -669,7 +666,7 @@ impl Page { } #[allow(clippy::too_many_lines)] - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::UpdateState(_state) => { if let Choice::Slideshow = self.selection.active { @@ -701,27 +698,23 @@ impl Page { } Message::ColorAdd(message) => { - match message { - ColorPickerUpdate::ActionFinished => { - let _res = self - .color_model - .update::(ColorPickerUpdate::AppliedColor); + if let ColorPickerUpdate::ActionFinished = message { + let _res = self + .color_model + .update::(ColorPickerUpdate::AppliedColor); - if let Some(color) = self.color_model.get_applied_color() { - let color = wallpaper::Color::Single([color.r, color.g, color.b]); - - if let Err(why) = self.config.add_custom_color(color.clone()) { - tracing::error!(?why, "could not set custom color"); - } + if let Some(color) = self.color_model.get_applied_color() { + let color = wallpaper::Color::Single([color.r, color.g, color.b]); - self.selection.add_custom_color(color.clone()); - self.selection.active = Choice::Color(color); - self.cached_display_handle = None; - self.context_view = None; + if let Err(why) = self.config.add_custom_color(color.clone()) { + tracing::error!(?why, "could not set custom color"); } - } - _ => (), + self.selection.add_custom_color(color.clone()); + self.selection.active = Choice::Color(color); + self.cached_display_handle = None; + self.context_view = None; + } }; return self.color_model.update::(message); @@ -747,7 +740,7 @@ impl Page { let Some((path, display, selection)) = result else { tracing::warn!("image not found for provided wallpaper"); - return Command::none(); + return Task::none(); }; if let Err(why) = self.config.add_custom_image(path.clone()) { @@ -757,7 +750,7 @@ impl Page { self.selection.add_custom_image( path, display, - ImageHandle::from_pixels( + ImageHandle::from_rgba( selection.width(), selection.height(), selection.into_vec(), @@ -777,7 +770,7 @@ impl Page { } Message::ImageAddDialog => { - return cosmic::command::future(async { + return cosmic::Task::future(async { let dialog_result = file_chooser::open::Dialog::new() .title(fl!("wallpaper", "image-dialog")) .accept_label(fl!("dialog-add")) @@ -816,7 +809,7 @@ impl Page { Message::Output(id) => { self.change_output(id); - return Command::none(); + return Task::none(); } Message::RotationFrequency(pos) => self.change_rotation_frequency(pos), @@ -837,20 +830,16 @@ impl Page { self.cache_display_image(); } else { if let Some(output) = self.config_output() { - match self.config.current_image(output) { - Some(Source::Path(path)) => { - if let Some(entity) = self.wallpaper_id_from_path(&path) { - if let Some(entry) = - self.config_wallpaper_entry(output.to_owned(), path) - { - self.select_wallpaper(&entry, entity, false); - self.config_apply(); - return Command::none(); - } + if let Some(Source::Path(path)) = self.config.current_image(output) { + if let Some(entity) = self.wallpaper_id_from_path(&path) { + if let Some(entry) = + self.config_wallpaper_entry(output.to_owned(), path) + { + self.select_wallpaper(&entry, entity, false); + self.config_apply(); + return Task::none(); } } - - _ => (), } } @@ -863,7 +852,7 @@ impl Page { DialogResponse::Path(path) => path, DialogResponse::Error(why) => { tracing::error!(why, "dialog response error"); - return Command::none(); + return Task::none(); } }; @@ -886,7 +875,7 @@ impl Page { let recurse = self.categories.selected == Some(Category::Wallpapers); // Load the wallpapers from the selected folder into the view. - return cosmic::command::future(async move { + return cosmic::Task::future(async move { let message = Message::ChangeFolder(change_folder(path, recurse).await); let page_message = crate::pages::Message::DesktopWallpaper(message); crate::Message::PageMessage(page_message) @@ -899,7 +888,7 @@ impl Page { DialogResponse::Path(path) => path, DialogResponse::Error(why) => { tracing::error!(why, "dialog response error"); - return Command::none(); + return Task::none(); } }; @@ -907,7 +896,7 @@ impl Page { tracing::info!(?path, "opening custom image"); // Loads a single custom image and its thumbnail for display in the backgrounds view. - return cosmic::command::future(async move { + return cosmic::Task::future(async move { let result = wallpaper::load_image_with_thumbnail(path); let message = Message::ImageAdd(result.map(Arc::new)); @@ -974,7 +963,7 @@ impl Page { } self.config_apply(); - Command::none() + Task::none() } /// Selects the given wallpaper entry. @@ -1125,7 +1114,7 @@ pub async fn change_folder(current_folder: PathBuf, recurse: bool) -> Context { update.display_images.insert(id, display_image); - let selection_handle = ImageHandle::from_pixels( + let selection_handle = ImageHandle::from_rgba( selection_image.width(), selection_image.height(), selection_image.into_vec(), @@ -1192,8 +1181,8 @@ pub fn settings() -> Section { if page.wallpaper_service_config.same_on_all { let element = text(fl!("all-displays")) .font(cosmic::font::semibold()) - .horizontal_alignment(alignment::Horizontal::Center) - .vertical_alignment(alignment::Vertical::Center) + .align_x(alignment::Horizontal::Center) + .align_y(alignment::Vertical::Center) .width(Length::Fill) .height(Length::Fill) .apply(cosmic::widget::container) @@ -1216,18 +1205,15 @@ pub fn settings() -> Section { let mut column = list_column() .add(settings::item( &descriptions[same_label], - toggler( - None, - page.wallpaper_service_config.same_on_all, - Message::SameWallpaper, - ), + toggler(page.wallpaper_service_config.same_on_all) + .on_toggle(Message::SameWallpaper), )) .add(settings::item(&descriptions[fit_label], wallpaper_fit)); if show_slideshow_toggle { column = column.add(settings::item( &descriptions[slide_label], - toggler(None, slideshow_enabled, Message::Slideshow), + toggler(slideshow_enabled).on_toggle(Message::Slideshow), )); } @@ -1269,7 +1255,7 @@ pub fn settings() -> Section { children.push( row::with_capacity(2) - .align_items(Alignment::Center) + .align_y(Alignment::Center) // Show a folder icon if the active category is a custom folder. .push_maybe( if let Some(Category::RecentFolder(_)) = page.categories.selected { @@ -1279,7 +1265,7 @@ pub fn settings() -> Section { }, ) .push(category_selection) - .push(cosmic::widget::horizontal_space(Length::Fill)) + .push(cosmic::widget::horizontal_space().width(Length::Fill)) .push_maybe(add_button) .into(), ); @@ -1346,7 +1332,7 @@ pub fn settings() -> Section { // .width(Length::Fill) // .height(Length::Fill) // .center_x() -// .style(cosmic::theme::style::Container::Background); +// .class(cosmic::theme::style::Container::Background); // cosmic::widget::column::with_capacity(2) // .push(header) diff --git a/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs b/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs index 3a621cb6..ddbaa3ff 100644 --- a/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs +++ b/cosmic-settings/src/pages/desktop/wallpaper/widgets.rs @@ -7,7 +7,7 @@ use cosmic::iced_core::Border; use cosmic::iced_core::{self, gradient::Linear, Background, Color, Degrees, Length}; use cosmic::iced_runtime::core::image::Handle as ImageHandle; use cosmic::prelude::*; -use cosmic::widget::{button, container, space}; +use cosmic::widget::{button, container, Space}; use cosmic::{iced, Element}; use cosmic_settings_wallpaper as wallpaper; use slotmap::DefaultKey; @@ -34,7 +34,7 @@ pub fn color_button( button::custom_image_button(content, on_remove) .padding(0) .selected(selected) - .style(button::Style::Image) + .class(button::ButtonClass::Image) .on_press(Message::ColorSelect(color)) .into() } @@ -47,9 +47,9 @@ pub fn color_image<'a, M: 'a>( height: u16, border_radius: Option, ) -> Element<'a, M> { - container(space::Space::new(width, height)) - .style(cosmic::theme::Container::custom(move |theme| { - container::Appearance { + container(Space::new(width, height)) + .class(cosmic::theme::Container::custom(move |theme| { + container::Style { icon_color: None, text_color: None, background: Some(match &color { @@ -173,8 +173,7 @@ fn flex_select_row(elements: Vec>) -> Element { .column_spacing(COLUMN_SPACING) .row_spacing(ROW_SPACING) .apply(container) - .width(Length::Fill) - .center_x() + .center_x(Length::Fill) .into() } diff --git a/cosmic-settings/src/pages/desktop/window_management.rs b/cosmic-settings/src/pages/desktop/window_management.rs index 527a1ffd..d9c7e54e 100644 --- a/cosmic-settings/src/pages/desktop/window_management.rs +++ b/cosmic-settings/src/pages/desktop/window_management.rs @@ -113,7 +113,7 @@ impl Page { self.focus_follows_cursor = value; if let Err(err) = self .comp_config - .set("focus_follows_cursor", &self.focus_follows_cursor) + .set("focus_follows_cursor", self.focus_follows_cursor) { error!(?err, "Failed to set config 'focus_follows_cursor'"); } @@ -141,7 +141,7 @@ impl Page { self.cursor_follows_focus = value; if let Err(err) = self .comp_config - .set("cursor_follows_focus", &self.cursor_follows_focus) + .set("cursor_follows_focus", self.cursor_follows_focus) { error!(?err, "Failed to set config 'cursor_follows_focus'"); } @@ -242,23 +242,15 @@ pub fn window_controls() -> Section { .title(§ion.title) .add(settings::item( &descriptions[active_window_hint], - toggler(None, page.show_active_hint, Message::ShowActiveWindowHint), + toggler(page.show_active_hint).on_toggle(Message::ShowActiveWindowHint), )) .add(settings::item( &descriptions[maximize], - toggler( - None, - cosmic::config::show_maximize(), - Message::ShowMaximizeButton, - ), + toggler(cosmic::config::show_maximize()).on_toggle(Message::ShowMaximizeButton), )) .add(settings::item( &descriptions[minimize], - toggler( - None, - cosmic::config::show_minimize(), - Message::ShowMinimizeButton, - ), + toggler(cosmic::config::show_minimize()).on_toggle(Message::ShowMinimizeButton), )) .apply(Element::from) .map(crate::pages::Message::WindowManagement) @@ -283,11 +275,7 @@ pub fn focus_navigation() -> Section { .title(§ion.title) .add(settings::item( &descriptions[focus_follows_cursor], - toggler( - None, - page.focus_follows_cursor, - Message::SetFocusFollowsCursor, - ), + toggler(page.focus_follows_cursor).on_toggle(Message::SetFocusFollowsCursor), )) .add(settings::item( &descriptions[focus_follows_cursor_delay], @@ -301,11 +289,7 @@ pub fn focus_navigation() -> Section { )) .add(settings::item( &descriptions[cursor_follows_focus], - toggler( - None, - page.cursor_follows_focus, - Message::SetCursorFollowsFocus, - ), + toggler(page.cursor_follows_focus).on_toggle(Message::SetCursorFollowsFocus), )) .apply(Element::from) .map(crate::pages::Message::WindowManagement) diff --git a/cosmic-settings/src/pages/display/arrangement.rs b/cosmic-settings/src/pages/display/arrangement.rs index 53bd126d..b9b1ea10 100644 --- a/cosmic-settings/src/pages/display/arrangement.rs +++ b/cosmic-settings/src/pages/display/arrangement.rs @@ -359,7 +359,7 @@ impl<'a, Message: Clone> Widget for Arrangemen core::text::Renderer::fill_text( renderer, core::Text { - content: itoa::Buffer::new().format(id), + content: itoa::Buffer::new().format(id).to_string(), size: core::Pixels(24.0), line_height: core::text::LineHeight::Relative(1.2), font: cosmic::font::bold(), @@ -367,7 +367,7 @@ impl<'a, Message: Clone> Widget for Arrangemen horizontal_alignment: alignment::Horizontal::Center, vertical_alignment: alignment::Vertical::Center, shaping: text::Shaping::Basic, - wrap: text::Wrap::Word, + wrapping: text::Wrapping::Word, }, core::Point { x: id_bounds.center_x(), @@ -405,21 +405,15 @@ fn display_regions<'a>( .iter() .filter_map(move |id| model.data::(id)) .filter_map(move |&key| { - let Some(output) = list.outputs.get(key) else { - return None; - }; + let output = list.outputs.get(key)?; if !output.enabled { return None; } - let Some(mode_key) = output.current else { - return None; - }; + let mode_key = output.current?; - let Some(mode) = list.modes.get(mode_key) else { - return None; - }; + let mode = list.modes.get(mode_key)?; let (mut width, mut height) = ( (mode.size.0 as f32 / output.scale as f32) / UNIT_PIXELS, diff --git a/cosmic-settings/src/pages/display/mod.rs b/cosmic-settings/src/pages/display/mod.rs index 3fe6395d..e91476f6 100644 --- a/cosmic-settings/src/pages/display/mod.rs +++ b/cosmic-settings/src/pages/display/mod.rs @@ -7,12 +7,11 @@ pub mod arrangement; use crate::{app, pages}; use arrangement::Arrangement; use cosmic::iced::{time, Alignment, Length}; -use cosmic::iced_widget::scrollable::{Direction, Properties, RelativeOffset}; -use cosmic::prelude::CollectionWidget; +use cosmic::iced_widget::scrollable::{Direction, RelativeOffset, Scrollbar}; use cosmic::widget::{ self, column, container, dropdown, list_column, segmented_button, tab_bar, text, toggler, }; -use cosmic::{command, Apply, Command, Element}; +use cosmic::{Apply, Element, Task}; use cosmic_config::{ConfigGet, ConfigSet}; use cosmic_randr_shell::{List, Output, OutputKey, Transform}; use cosmic_settings_page::{self as page, section, Section}; @@ -237,7 +236,7 @@ impl page::Page for Page { &mut self, _page: page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { if let Some(task) = self.background_service.take() { task.abort(); } @@ -264,15 +263,15 @@ impl page::Page for Page { }); })); - command::future(on_enter()) + cosmic::command::future(on_enter()) } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { if let Some(task) = self.background_service.take() { task.abort(); } - Command::none() + Task::none() } #[cfg(feature = "test")] @@ -280,8 +279,8 @@ impl page::Page for Page { &mut self, _page: page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> Command { - command::future(async move { + ) -> Task { + cosmic::command::future(async move { let mut randr = List::default(); let test_mode = randr.modes.insert(cosmic_randr_shell::Mode { @@ -341,7 +340,7 @@ impl page::Page for Page { /// To make a setting activate this dialog. Call the `set_dialog` method with /// the Randr enum value which undos the current change. Makde sure the /// return value is returned with the `exec_value` return value within a batch - /// command. + /// Task. fn dialog(&self) -> Option> { self.dialog?; let element = widget::dialog(fl!("dialog", "title")) @@ -360,7 +359,7 @@ impl page::Page for Page { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::RandrResult(result) => { if let Some(Err(why)) = Arc::into_inner(result) { @@ -375,10 +374,10 @@ impl Page { Message::DialogCancel => { let Some(request) = self.dialog else { - return Command::none(); + return Task::none(); }; let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; self.dialog = None; self.dialog_countdown = 0; @@ -393,11 +392,11 @@ impl Page { Message::DialogCountdown => { if self.dialog_countdown == 0 { if self.dialog.is_some() { - return command::message(app::Message::from(Message::DialogCancel)); + return cosmic::command::message(app::Message::from(Message::DialogCancel)); } } else { self.dialog_countdown -= 1; - return command::future(async move { + return cosmic::command::future(async move { tokio::time::sleep(time::Duration::from_secs(1)).await; Message::DialogCountdown }); @@ -417,7 +416,7 @@ impl Page { Mirroring::Mirror(from_display) => { let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; return self.exec_randr(output, Randr::Mirror(from_display)); @@ -425,7 +424,7 @@ impl Page { Mirroring::Project(to_display) => { let Some(output) = self.list.outputs.get(to_display) else { - return Command::none(); + return Task::none(); }; return self.exec_randr(output, Randr::Mirror(self.active_display)); @@ -494,7 +493,7 @@ impl Page { self.comp_config_descale_xwayland = descale; if let Err(err) = self .comp_config - .set("descale_xwayland", &self.comp_config_descale_xwayland) + .set("descale_xwayland", self.comp_config_descale_xwayland) { error!(?err, "Failed to set config 'descale_xwayland'"); } @@ -564,29 +563,25 @@ impl Page { /// Sets the dialog to be shown to the user. Will not show a dialog if the /// current request does not change anything. - fn set_dialog( - &mut self, - revert_request: Randr, - current_request: &Randr, - ) -> Command { + fn set_dialog(&mut self, revert_request: Randr, current_request: &Randr) -> Task { if revert_request == *current_request { - return Command::none(); + return Task::none(); } self.dialog = Some(revert_request); self.dialog_countdown = 10; - command::future(async { + cosmic::command::future(async { tokio::time::sleep(time::Duration::from_secs(1)).await; app::Message::from(Message::DialogCountdown) }) } /// Changes the color depth of the active display. - pub fn set_color_depth(&mut self, _depth: ColorDepth) -> Command { + pub fn set_color_depth(&mut self, _depth: ColorDepth) -> Task { unimplemented!() } /// Changes the color profile of the active display. - pub fn set_color_profile(&mut self, _profile: usize) -> Command { + pub fn set_color_profile(&mut self, _profile: usize) -> Task { unimplemented!() } @@ -713,11 +708,11 @@ impl Page { } /// Change display orientation. - pub fn set_orientation(&mut self, transform: Transform) -> Command { + pub fn set_orientation(&mut self, transform: Transform) -> Task { let request = Randr::Transform(transform); - let mut commands = Vec::with_capacity(2); - commands.push(match self.cache.orientation_selected { + let mut tasks = Vec::with_capacity(2); + tasks.push(match self.cache.orientation_selected { Some(orientation) => self.set_dialog( Randr::Transform(match orientation { 1 => Transform::Rotate90, @@ -727,11 +722,11 @@ impl Page { }), &request, ), - None => Command::none(), + None => Task::none(), }); let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; self.cache.orientation_selected = match transform { @@ -741,22 +736,22 @@ impl Page { _ => Some(3), }; - commands.push(self.exec_randr(output, Randr::Transform(transform))); + tasks.push(self.exec_randr(output, Randr::Transform(transform))); - Command::batch(commands) + Task::batch(tasks) } /// Changes the position of the display. - pub fn set_position(&mut self, display: OutputKey, x: i32, y: i32) -> Command { + pub fn set_position(&mut self, display: OutputKey, x: i32, y: i32) -> Task { let Some(output) = self.list.outputs.get_mut(display) else { - return Command::none(); + return Task::none(); }; output.position = (x, y); if cfg!(feature = "test") { tracing::debug!("set position {x},{y}"); - return Command::none(); + return Task::none(); } let output = &self.list.outputs[display]; @@ -764,9 +759,9 @@ impl Page { } /// Changes the refresh rate of the active display. - pub fn set_refresh_rate(&mut self, option: usize) -> Command { + pub fn set_refresh_rate(&mut self, option: usize) -> Task { let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; if let Some(ref resolution) = self.config.resolution { @@ -779,26 +774,26 @@ impl Page { } } - Command::none() + Task::none() } /// Change the resolution of the active display. - pub fn set_resolution(&mut self, option: usize) -> Command { - let mut commands = Vec::with_capacity(2); + pub fn set_resolution(&mut self, option: usize) -> Task { + let mut tasks = Vec::with_capacity(2); let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; let Some((&resolution, rates)) = self.cache.modes.iter().rev().nth(option) else { - return Command::none(); + return Task::none(); }; self.cache.refresh_rates.clear(); cache_rates(&mut self.cache.refresh_rates, rates); let Some(&rate) = rates.first() else { - return Command::none(); + return Task::none(); }; let request = Randr::Resolution(resolution.0, resolution.1); @@ -811,18 +806,18 @@ impl Page { self.config.resolution = Some(resolution); self.cache.refresh_rate_selected = Some(0); self.cache.resolution_selected = Some(option); - commands.push(self.exec_randr(output, Randr::Resolution(resolution.0, resolution.1))); - commands.push(self.set_dialog(revert_request, &request)); + tasks.push(self.exec_randr(output, Randr::Resolution(resolution.0, resolution.1))); + tasks.push(self.set_dialog(revert_request, &request)); - Command::batch(commands) + Task::batch(tasks) } /// Set the scale of the active display. - pub fn set_scale(&mut self, option: usize) -> Command { - let mut commands = Vec::with_capacity(2); + pub fn set_scale(&mut self, option: usize) -> Task { + let mut tasks = Vec::with_capacity(2); let Some(output) = self.list.outputs.get(self.active_display) else { - return Command::none(); + return Task::none(); }; let scale = (option * 25 + 50) as u32; @@ -832,18 +827,18 @@ impl Page { self.cache.scale_selected = Some(option); self.config.scale = scale; - commands.push(self.exec_randr(output, Randr::Scale(scale))); - commands.push(self.set_dialog(revert_request, &request)); - Command::batch(commands) + tasks.push(self.exec_randr(output, Randr::Scale(scale))); + tasks.push(self.set_dialog(revert_request, &request)); + Task::batch(tasks) } /// Enables or disables the active display. - pub fn toggle_display(&mut self, enable: bool) -> Command { - let mut commands = Vec::with_capacity(2); + pub fn toggle_display(&mut self, enable: bool) -> Task { + let mut tasks = Vec::with_capacity(2); let request = Randr::Toggle(enable); let Some(output) = self.list.outputs.get_mut(self.active_display) else { - return Command::none(); + return Task::none(); }; let revert_request = Randr::Toggle(output.enabled); @@ -852,44 +847,40 @@ impl Page { output.enabled = enable; let output = &self.list.outputs[self.active_display]; - commands.push(self.exec_randr(output, request)); - commands.push(self.set_dialog(revert_request, ¤t_request)); - Command::batch(commands) + tasks.push(self.exec_randr(output, request)); + tasks.push(self.set_dialog(revert_request, ¤t_request)); + Task::batch(tasks) } /// Applies a display configuration via `cosmic-randr`. - fn exec_randr(&self, output: &Output, request: Randr) -> Command { - let mut commands = Vec::with_capacity(2); + fn exec_randr(&self, output: &Output, request: Randr) -> Task { + let mut tasks = Vec::with_capacity(2); // Removes the dialog if no change is being made if Some(request) == self.dialog { - commands.push(command::message(app::Message::from( + tasks.push(cosmic::command::message(app::Message::from( Message::DialogComplete, ))); } let name = &*output.name; - let mut command = tokio::process::Command::new("cosmic-randr"); + let mut task = tokio::process::Command::new("cosmic-randr"); match request { Randr::Mirror(from_id) => { let Some(from_output) = self.list.outputs.get(from_id) else { - return Command::none(); + return Task::none(); }; - command - .arg("mirror") - .arg(&output.name) - .arg(&from_output.name); + task.arg("mirror").arg(&output.name).arg(&from_output.name); } Randr::Position(x, y) => { let Some(current) = output.current.and_then(|id| self.list.modes.get(id)) else { - return Command::none(); + return Task::none(); }; - command - .arg("mode") + task.arg("mode") .arg("--pos-x") .arg(itoa::Buffer::new().format(x)) .arg("--pos-y") @@ -901,14 +892,13 @@ impl Page { Randr::RefreshRate(rate) => { let Some(current) = output.current.and_then(|id| self.list.modes.get(id)) else { - return Command::none(); + return Task::none(); }; - command - .arg("mode") + task.arg("mode") .arg("--refresh") .arg( - &[ + [ itoa::Buffer::new().format(rate / 1000), ".", itoa::Buffer::new().format(rate % 1000), @@ -921,8 +911,7 @@ impl Page { } Randr::Resolution(width, height) => { - command - .arg("mode") + task.arg("mode") .arg(name) .arg(itoa::Buffer::new().format(width)) .arg(itoa::Buffer::new().format(height)); @@ -930,14 +919,13 @@ impl Page { Randr::Scale(scale) => { let Some(current) = output.current.and_then(|id| self.list.modes.get(id)) else { - return Command::none(); + return Task::none(); }; - command - .arg("mode") + task.arg("mode") .arg("--scale") .arg( - &[ + [ itoa::Buffer::new().format(scale / 100), ".", itoa::Buffer::new().format(scale % 100), @@ -950,18 +938,16 @@ impl Page { } Randr::Toggle(enable) => { - command - .arg(if enable { "enable" } else { "disable" }) + task.arg(if enable { "enable" } else { "disable" }) .arg(name); } Randr::Transform(transform) => { let Some(current) = output.current.and_then(|id| self.list.modes.get(id)) else { - return Command::none(); + return Task::none(); }; - command - .arg("mode") + task.arg("mode") .arg("--transform") .arg(&*format!("{transform}")) .arg(name) @@ -970,11 +956,11 @@ impl Page { } } - commands.push(cosmic::command::future(async move { - tracing::debug!(?command, "executing"); - app::Message::from(Message::RandrResult(Arc::new(command.status().await))) + tasks.push(cosmic::command::future(async move { + tracing::debug!(?task, "executing"); + app::Message::from(Message::RandrResult(Arc::new(task.status().await))) })); - Command::batch(commands) + Task::batch(tasks) } } @@ -1011,10 +997,9 @@ pub fn display_arrangement() -> Section { .apply(widget::scrollable) .id(page.display_arrangement_scrollable.clone()) .width(Length::Shrink) - .direction(Direction::Horizontal(Properties::new())) + .direction(Direction::Horizontal(Scrollbar::new())) .apply(container) - .center_x() - .width(Length::Fill) + .center_x(Length::Fill) }) .apply(widget::list::container) .into() @@ -1106,7 +1091,7 @@ pub fn display_configuration() -> Section { let mut column = list_column() .add(widget::settings::item( &descriptions[enable_label], - toggler(None, active_output.enabled, Message::DisplayToggle), + toggler(active_output.enabled).on_toggle(Message::DisplayToggle), )) .add(widget::settings::item( &descriptions[mirroring_label], diff --git a/cosmic-settings/src/pages/display/night_light.rs b/cosmic-settings/src/pages/display/night_light.rs index cfea6a7c..61619a57 100644 --- a/cosmic-settings/src/pages/display/night_light.rs +++ b/cosmic-settings/src/pages/display/night_light.rs @@ -6,7 +6,7 @@ use crate::pages; use cosmic::iced_core::{Alignment, Length, Padding}; use cosmic::prelude::CollectionWidget; use cosmic::widget::{button, column, icon, list_column, row, toggler}; -use cosmic::{Apply, Command, Element}; +use cosmic::{Apply, Element, Task}; use std::sync::Arc; pub fn view( @@ -25,7 +25,7 @@ pub fn view( .push(cosmic::widget::Space::new(Length::Fill, 12)) .push_maybe(button.map(|(text, message)| { button::text(text) - .style(cosmic::theme::Button::Link) + .class(cosmic::theme::Button::Link) .trailing_icon(icon::from_name("go-next-symbolic").size(16)) .padding(0) .on_press(message) @@ -55,7 +55,7 @@ impl super::Page { .control( row() .align_items(Alignment::Center) - .push(toggler(None, self.config.night_light_enabled, |enable| { + .push(toggler(self.config.night_light_enabled, |enable| { Message::NightLight(NightLight::Toggle(enable)) })) .push( diff --git a/cosmic-settings/src/pages/input/keyboard/mod.rs b/cosmic-settings/src/pages/input/keyboard/mod.rs index a49b3263..25cfc744 100644 --- a/cosmic-settings/src/pages/input/keyboard/mod.rs +++ b/cosmic-settings/src/pages/input/keyboard/mod.rs @@ -6,9 +6,9 @@ use cosmic::{ cosmic_config::{self, ConfigSet}, iced::{self, Length}, iced_core::Border, - iced_style, theme, + theme, widget::{self, button, container, icon, radio, row, settings, ListColumn}, - Apply, Command, Element, + Apply, Element, Task, }; use cosmic_comp_config::XkbConfig; use cosmic_settings_page::{self as page, section, Section}; @@ -154,15 +154,15 @@ fn popover_menu_row( ) -> cosmic::Element<'static, Message> { widget::text::body(label) .apply(widget::container) - .style(cosmic::theme::Container::custom(|theme| { - iced_style::container::Appearance { + .class(cosmic::theme::Container::custom(|theme| { + widget::container::Style { background: None, - ..container::StyleSheet::appearance(theme, &cosmic::theme::Container::List) + ..container::Catalog::style(theme, &cosmic::theme::Container::List) } })) .apply(button::custom) .on_press(()) - .style(theme::Button::Transparent) + .class(theme::Button::Transparent) .apply(Element::from) .map(move |()| Message::SourceContext(message(id))) } @@ -173,36 +173,32 @@ fn popover_menu(id: DefaultKey) -> cosmic::Element<'static, Message> { id, fl!("keyboard-sources", "move-up"), SourceContext::MoveUp, - ) - .into(), + ), popover_menu_row( id, fl!("keyboard-sources", "move-down"), SourceContext::MoveDown, - ) - .into(), + ), cosmic::widget::divider::horizontal::default().into(), popover_menu_row( id, fl!("keyboard-sources", "settings"), SourceContext::Settings, - ) - .into(), + ), popover_menu_row( id, fl!("keyboard-sources", "view-layout"), SourceContext::ViewLayout, - ) - .into(), - popover_menu_row(id, fl!("keyboard-sources", "remove"), SourceContext::Remove).into(), + ), + popover_menu_row(id, fl!("keyboard-sources", "remove"), SourceContext::Remove), ]) .padding(8) .width(Length::Shrink) .height(Length::Shrink) .apply(cosmic::widget::container) - .style(cosmic::theme::Container::custom(|theme| { + .class(cosmic::theme::Container::custom(|theme| { let cosmic = theme.cosmic(); - container::Appearance { + container::Style { icon_color: Some(theme.cosmic().background.on.into()), text_color: Some(theme.cosmic().background.on.into()), background: Some(iced::Color::from(theme.cosmic().background.base).into()), @@ -291,7 +287,7 @@ impl page::Page for Page { &mut self, _page: page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.xkb = super::get_config(&self.config, "xkb_config"); match ( xkb_data::keyboard_layouts(), @@ -389,12 +385,12 @@ impl page::Page for Page { } } - Command::none() + Task::none() } } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::InputSourceSearch(search) => { self.input_source_search = search; @@ -502,7 +498,7 @@ impl Page { } } - Command::none() + Task::none() } pub fn add_input_source_view(&self) -> Element<'_, crate::pages::Message> { @@ -674,15 +670,15 @@ fn special_character_entry() -> Section { settings::section() .title(§ion.title) .add(crate::widget::go_next_item( - &*descriptions[alternate], + &descriptions[alternate], Message::OpenSpecialCharacterContext(SpecialKey::AlternateCharacters), )) .add(crate::widget::go_next_item( - &*descriptions[compose], + &descriptions[compose], Message::OpenSpecialCharacterContext(SpecialKey::Compose), )) .add(crate::widget::go_next_item( - &*descriptions[caps], + &descriptions[caps], Message::OpenSpecialCharacterContext(SpecialKey::CapsLock), )) .apply(cosmic::Element::from) @@ -749,7 +745,7 @@ fn keyboard_typing_assist() -> Section { .max_width(250); row::with_capacity(3) - .align_items(iced::Alignment::Center) + .align_y(iced::Alignment::Center) .spacing(theme.cosmic().space_s()) .push(widget::text::body(&descriptions[short])) .push(delay_slider) @@ -769,7 +765,7 @@ fn keyboard_typing_assist() -> Section { .max_width(250); row::with_capacity(3) - .align_items(iced::Alignment::Center) + .align_y(iced::Alignment::Center) .spacing(theme.cosmic().space_s()) .push(widget::text::body(&descriptions[slow])) .push(rate_slider) diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs index c26ba26e..5d97915a 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/common.rs @@ -1,8 +1,7 @@ use cosmic::iced::alignment::Horizontal; use cosmic::iced::{Alignment, Length}; -use cosmic::prelude::CollectionWidget; use cosmic::widget::{self, button, icon, settings, text}; -use cosmic::{command, theme, Apply, Command, Element}; +use cosmic::{theme, Apply, Element, Task}; use cosmic_config::{ConfigGet, ConfigSet}; use cosmic_settings_config::shortcuts::{self, Action, Binding, Shortcuts}; use slab::Slab; @@ -240,7 +239,7 @@ impl Model { } #[allow(clippy::too_many_lines)] - pub(super) fn update(&mut self, message: ShortcutMessage) -> Command { + pub(super) fn update(&mut self, message: ShortcutMessage) -> Task { match message { ShortcutMessage::AddKeybinding => { if let Some(short_id) = self.shortcut_context { @@ -390,18 +389,18 @@ impl Model { self.shortcut_context = Some(id); self.replace_dialog = None; - let mut commands = vec![command::message(crate::app::Message::OpenContextDrawer( - description.into(), - ))]; + let mut tasks = vec![cosmic::command::message( + crate::app::Message::OpenContextDrawer(description.into()), + )]; if let Some(model) = self.shortcut_models.get(0) { if let Some(shortcut) = model.bindings.get(0) { - commands.push(widget::text_input::focus(shortcut.id.clone())); - commands.push(widget::text_input::select_all(shortcut.id.clone())); + tasks.push(widget::text_input::focus(shortcut.id.clone())); + tasks.push(widget::text_input::select_all(shortcut.id.clone())); } } - return Command::batch(commands); + return Task::batch(tasks); } ShortcutMessage::SubmitBinding(id) => { @@ -415,7 +414,7 @@ impl Model { Ok(new_binding) => { if !new_binding.is_set() { shortcut.input.clear(); - return Command::none(); + return Task::none(); } if let Some(action) = self.config_contains(&new_binding) { let action_str = if let Action::Spawn(_) = &action { @@ -425,7 +424,7 @@ impl Model { }; self.replace_dialog = Some((id, new_binding, action, action_str)); - return Command::none(); + return Task::none(); } apply_binding = Some(new_binding); @@ -459,7 +458,7 @@ impl Model { } } - Command::none() + Task::none() } pub(super) fn view(&self) -> Element { @@ -486,8 +485,8 @@ fn context_drawer( let model = &shortcuts[id]; let action = show_action.then(|| { - let description = if let Action::Spawn(command) = &model.action { - Cow::Borrowed(command.as_str()) + let description = if let Action::Spawn(task) = &model.action { + Cow::Borrowed(task.as_str()) } else { Cow::Owned(super::localize_action(&model.action)) }; @@ -573,7 +572,7 @@ fn shortcut_item(custom: bool, id: usize, data: &ShortcutModel) -> Element Element, - command_id: widget::Id, + task_id: widget::Id, name_id: widget::Id, } @@ -25,7 +25,7 @@ impl Default for Page { model: super::Model::default().custom().actions(bindings), add_shortcut: AddShortcut::default(), replace_dialog: Vec::new(), - command_id: widget::Id::unique(), + task_id: widget::Id::unique(), name_id: widget::Id::unique(), } } @@ -37,8 +37,8 @@ pub enum Message { AddKeybinding, /// Add a new custom shortcut to the config AddShortcut, - /// Update the command text input - CommandInput(String), + /// Update the Task text input + TaskInput(String), /// Toggle editing of the key text input EditCombination, /// Toggle editability of the key text input @@ -63,7 +63,7 @@ pub enum Message { struct AddShortcut { pub active: bool, pub name: String, - pub command: String, + pub task: String, pub keys: Slab<(String, widget::Id, bool)>, } @@ -71,7 +71,7 @@ impl AddShortcut { pub fn enable(&mut self) { self.active = true; self.name.clear(); - self.command.clear(); + self.task.clear(); if self.keys.is_empty() { self.keys @@ -87,10 +87,10 @@ impl AddShortcut { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { - Message::CommandInput(text) => { - self.add_shortcut.command = text; + Message::TaskInput(text) => { + self.add_shortcut.task = text; } Message::KeyInput(id, text) => { @@ -121,7 +121,7 @@ impl Page { self.add_shortcut .keys .insert((String::new(), new_id.clone(), true)); - return Command::batch(vec![ + return Task::batch(vec![ widget::text_input::focus(new_id.clone()), widget::text_input::select_all(new_id), ]); @@ -129,10 +129,10 @@ impl Page { Message::AddShortcut => { let name = self.add_shortcut.name.trim(); - let command = self.add_shortcut.command.trim(); + let task = self.add_shortcut.task.trim(); - if name.is_empty() || command.is_empty() { - return Command::none(); + if name.is_empty() || task.is_empty() { + return Task::none(); } let mut addable_bindings = Vec::new(); @@ -143,11 +143,11 @@ impl Page { } let Ok(binding) = Binding::from_str(keys) else { - return Command::none(); + return Task::none(); }; if !binding.is_set() { - return Command::none(); + return Task::none(); } if let Some(action) = self.model.config_contains(&binding) { @@ -169,7 +169,7 @@ impl Page { Message::EditCombination => { let (_, id, editing) = &mut self.add_shortcut.keys[0]; *editing = true; - return Command::batch(vec![ + return Task::batch(vec![ widget::text_input::focus(id.clone()), widget::text_input::select_all(id.clone()), ]); @@ -177,7 +177,7 @@ impl Page { Message::NameSubmit => { if !self.add_shortcut.name.trim().is_empty() { - return widget::text_input::focus(self.command_id.clone()); + return widget::text_input::focus(self.task_id.clone()); } } @@ -209,7 +209,7 @@ impl Page { Message::ShortcutContext => { self.add_shortcut.enable(); - return Command::batch(vec![ + return Task::batch(vec![ cosmic::command::message(crate::app::Message::OpenContextDrawer( fl!("custom-shortcuts", "context").into(), )), @@ -218,7 +218,7 @@ impl Page { } } - Command::none() + Task::none() } fn add_keybinding_context(&self) -> Element<'_, Message> { @@ -228,11 +228,11 @@ impl Page { .on_submit(Message::NameSubmit) .id(self.name_id.clone()); - let command_input = widget::text_input("", &self.add_shortcut.command) + let task_input = widget::text_input("", &self.add_shortcut.task) .padding([6, 12]) - .on_input(Message::CommandInput) + .on_input(Message::TaskInput) .on_submit(Message::EditCombination) - .id(self.command_id.clone()); + .id(self.task_id.clone()); let name_control = widget::column() .spacing(4) @@ -242,7 +242,7 @@ impl Page { let command_control = widget::column() .spacing(4) .push(widget::text::body(fl!("command"))) - .push(command_input); + .push(task_input); let input_fields = widget::column() .spacing(12) @@ -288,7 +288,7 @@ impl Page { fn add_shortcut(&mut self, mut binding: Binding) { self.add_shortcut.active = !self.replace_dialog.is_empty(); binding.description = Some(self.add_shortcut.name.clone()); - let new_action = Action::Spawn(self.add_shortcut.command.clone()); + let new_action = Action::Spawn(self.add_shortcut.task.clone()); self.model.config_add(new_action, binding); } } @@ -350,14 +350,14 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } @@ -367,11 +367,11 @@ fn bindings(_defaults: &Shortcuts, keybindings: &Shortcuts) -> Slab Command { + pub fn update(&mut self, message: ShortcutMessage) -> Task { self.model.update(message) } } @@ -56,15 +56,15 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs index 4d275511..2b0aec76 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/mod.rs @@ -11,7 +11,7 @@ pub mod tiling; use cosmic::iced::Length; use cosmic::widget::{self, icon, settings, text}; -use cosmic::{command, theme, Apply, Command, Element}; +use cosmic::{theme, Apply, Element, Task}; use cosmic_config::ConfigGet; use cosmic_settings_config::shortcuts::action::{ Direction, FocusDirection, Orientation, ResizeDirection, @@ -136,7 +136,7 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { if self.shortcuts_context.is_none() { self.shortcuts_context = cosmic_settings_config::shortcuts::context().ok(); } @@ -193,10 +193,10 @@ impl page::Page for Page { self.search.shortcuts = defaults; } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.search.actions.clear(); self.search.localized.clear(); self.search.input.clear(); @@ -206,40 +206,42 @@ impl page::Page for Page { self.modified.move_windows = 0; self.modified.nav = 0; self.modified.system = 0; - Command::none() + Task::none() } } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::Category(category) => match category { Category::Custom => { - command::message(crate::app::Message::Page(self.sub_pages.custom)) + cosmic::command::message(crate::app::Message::Page(self.sub_pages.custom)) } - Category::ManageWindow => { - command::message(crate::app::Message::Page(self.sub_pages.manage_window)) - } + Category::ManageWindow => cosmic::command::message(crate::app::Message::Page( + self.sub_pages.manage_window, + )), Category::MoveWindow => { - command::message(crate::app::Message::Page(self.sub_pages.move_window)) + cosmic::command::message(crate::app::Message::Page(self.sub_pages.move_window)) } - Category::Nav => command::message(crate::app::Message::Page(self.sub_pages.nav)), + Category::Nav => { + cosmic::command::message(crate::app::Message::Page(self.sub_pages.nav)) + } Category::System => { - command::message(crate::app::Message::Page(self.sub_pages.system)) + cosmic::command::message(crate::app::Message::Page(self.sub_pages.system)) } - Category::WindowTiling => { - command::message(crate::app::Message::Page(self.sub_pages.window_tiling)) - } + Category::WindowTiling => cosmic::command::message(crate::app::Message::Page( + self.sub_pages.window_tiling, + )), }, Message::Search(input) => { self.search(input); - Command::none() + Task::none() } Message::SearchShortcut(message) => self.search_model.update(message), @@ -369,8 +371,7 @@ fn shortcuts() -> Section { .on_input(Message::Search) .apply(widget::container) .padding([2, 0, 0, 0]) - .center_x() - .width(Length::Fill); + .center_x(Length::Fill); // If the search input is not empty, show the category view, else the search results. let content = if page.search.input.is_empty() { @@ -436,9 +437,9 @@ fn category_item(category: Category, name: &str, modified: u16) -> Element String { SystemAction::WorkspaceOverview => fl!("system-shortcut", "workspace-overview"), }, - Action::Spawn(command) => command.clone(), + Action::Spawn(task) => task.clone(), } } @@ -669,6 +670,6 @@ fn localize_custom_action(action: &Action, binding: &Binding) -> String { if let Some(description) = &binding.description { description.to_string() } else { - localize_action(&action) + localize_action(action) } } diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs index 940a5ac8..bffd3c8b 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/move_window.rs @@ -1,5 +1,5 @@ use super::{ShortcutMessage, ShortcutModel}; -use cosmic::{Command, Element}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::action::Direction; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_page::{self as page, section, Section}; @@ -23,7 +23,7 @@ impl Default for Page { } impl Page { - pub fn update(&mut self, message: ShortcutMessage) -> Command { + pub fn update(&mut self, message: ShortcutMessage) -> Task { self.model.update(message) } } @@ -56,15 +56,15 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/nav.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/nav.rs index 8a74357d..ae526ac6 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/nav.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/nav.rs @@ -1,5 +1,5 @@ use super::{ShortcutMessage, ShortcutModel}; -use cosmic::{Command, Element}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection}; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_page::{self as page, section, Section}; @@ -23,7 +23,7 @@ impl Default for Page { } impl Page { - pub fn update(&mut self, message: ShortcutMessage) -> Command { + pub fn update(&mut self, message: ShortcutMessage) -> Task { self.model.update(message) } } @@ -56,15 +56,15 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs index 743d4a45..38060e13 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/system.rs @@ -1,5 +1,5 @@ use super::{ShortcutMessage, ShortcutModel}; -use cosmic::{Command, Element}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::action::System as SystemAction; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_page::{self as page, section, Section}; @@ -23,7 +23,7 @@ impl Default for Page { } impl Page { - pub fn update(&mut self, message: ShortcutMessage) -> Command { + pub fn update(&mut self, message: ShortcutMessage) -> Task { self.model.update(message) } } @@ -56,15 +56,15 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs b/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs index 006d6c4d..e92ff435 100644 --- a/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs +++ b/cosmic-settings/src/pages/input/keyboard/shortcuts/tiling.rs @@ -1,5 +1,5 @@ use super::{ShortcutMessage, ShortcutModel}; -use cosmic::{Command, Element}; +use cosmic::{Element, Task}; use cosmic_settings_config::shortcuts::action::Orientation; use cosmic_settings_config::shortcuts::Action; use cosmic_settings_page::{self as page, section, Section}; @@ -23,7 +23,7 @@ impl Default for Page { } impl Page { - pub fn update(&mut self, message: ShortcutMessage) -> Command { + pub fn update(&mut self, message: ShortcutMessage) -> Task { self.model.update(message) } } @@ -56,15 +56,15 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { self.model.on_enter(); - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.model.on_clear(); - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/mod.rs b/cosmic-settings/src/pages/input/mod.rs index b211745d..e1573907 100644 --- a/cosmic-settings/src/pages/input/mod.rs +++ b/cosmic-settings/src/pages/input/mod.rs @@ -1,7 +1,7 @@ use crate::app; use cosmic::{ cosmic_config::{self, ConfigGet, ConfigSet}, - Command, + Task, }; use cosmic_comp_config::input::{ AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap, @@ -96,7 +96,7 @@ impl Page { } #[allow(clippy::too_many_lines)] - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::SetAcceleration(value, touchpad) => { let profile = if value { @@ -155,7 +155,7 @@ impl Page { select_model.activate(entity); let Some(left_entity) = select_model.entity_at(1) else { - return Command::none(); + return Task::none(); }; let left_handed = select_model.active() == left_entity; @@ -176,7 +176,7 @@ impl Page { } } - Command::none() + Task::none() } } diff --git a/cosmic-settings/src/pages/input/mouse.rs b/cosmic-settings/src/pages/input/mouse.rs index e6c61c3c..ecdf9ac9 100644 --- a/cosmic-settings/src/pages/input/mouse.rs +++ b/cosmic-settings/src/pages/input/mouse.rs @@ -80,7 +80,7 @@ fn mouse() -> Section { .max_width(250); row::with_capacity(2) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(theme.cosmic().space_s()) .push(text::body(format!("{:.0}", value.round()))) .push(slider) @@ -140,7 +140,7 @@ fn scrolling() -> Section { .max_width(250); row::with_capacity(2) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(theme.cosmic().space_s()) .push(text::body(format!("{:.0}", value.round()))) .push(slider) diff --git a/cosmic-settings/src/pages/input/touchpad.rs b/cosmic-settings/src/pages/input/touchpad.rs index 7b352371..997d19e8 100644 --- a/cosmic-settings/src/pages/input/touchpad.rs +++ b/cosmic-settings/src/pages/input/touchpad.rs @@ -103,7 +103,7 @@ fn touchpad() -> Section { .max_width(250); row::with_capacity(2) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(theme.cosmic().space_s()) .push(text::body(format!("{:.0}", value.round()))) .push(slider) @@ -249,7 +249,7 @@ fn scrolling() -> Section { .max_width(250); row::with_capacity(2) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(theme.cosmic().space_s()) .push(text::body(format!("{:.0}", value.round()))) .push(slider) diff --git a/cosmic-settings/src/pages/mod.rs b/cosmic-settings/src/pages/mod.rs index 0c07defc..dc2b2b50 100644 --- a/cosmic-settings/src/pages/mod.rs +++ b/cosmic-settings/src/pages/mod.rs @@ -24,9 +24,14 @@ pub enum Message { DesktopWallpaper(desktop::wallpaper::Message), DesktopWorkspaces(desktop::workspaces::Message), Displays(display::Message), + #[cfg(feature = "wayland")] Dock(desktop::dock::Message), + #[cfg(feature = "wayland")] DockApplet(desktop::dock::applets::Message), - External { id: String, message: Vec }, + External { + id: String, + message: Vec, + }, Input(input::Message), Keyboard(input::keyboard::Message), KeyboardShortcuts(input::keyboard::shortcuts::Message), @@ -35,7 +40,9 @@ pub enum Message { NavShortcuts(input::keyboard::shortcuts::ShortcutMessage), Networking(networking::Message), Page(Entity), + #[cfg(feature = "wayland")] Panel(desktop::panel::Message), + #[cfg(feature = "wayland")] PanelApplet(desktop::panel::applets_inner::Message), Power(power::Message), Sound(sound::Message), diff --git a/cosmic-settings/src/pages/networking/mod.rs b/cosmic-settings/src/pages/networking/mod.rs index e088bcd6..3e47df89 100644 --- a/cosmic-settings/src/pages/networking/mod.rs +++ b/cosmic-settings/src/pages/networking/mod.rs @@ -8,7 +8,7 @@ pub mod wired; use std::{ffi::OsStr, process::Stdio, sync::Arc}; use anyhow::Context; -use cosmic::{widget, Apply, Command, Element}; +use cosmic::{widget, Apply, Element, Task}; use cosmic_dbus_networkmanager::{ interface::enums::{DeviceState, DeviceType}, nm::NetworkManager, @@ -223,9 +223,9 @@ impl page::Page for Page { &mut self, _page: page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { + ) -> cosmic::Task { if self.nm_task.is_none() { - return cosmic::command::future(async move { + return cosmic::Task::future(async move { zbus::Connection::system() .await .context("failed to create system dbus connection") @@ -237,17 +237,17 @@ impl page::Page for Page { }); } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.devices = Vec::new(); if let Some(cancel) = self.nm_task.take() { _ = cancel.send(()); } - Command::none() + Task::none() } } @@ -269,7 +269,7 @@ impl page::AutoBind for Page { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { let span = tracing::span!(tracing::Level::INFO, "networking::update"); let _span = span.enter(); @@ -283,12 +283,12 @@ impl Page { } Message::OpenPage { page, device } => { - let mut commands = Vec::>::new(); + let mut tasks = Vec::>::new(); - commands.push(cosmic::command::message(crate::app::Message::Page(page))); + tasks.push(cosmic::command::message(crate::app::Message::Page(page))); if let Some(device) = device { - commands.push(cosmic::command::message(crate::app::Message::PageMessage( + tasks.push(cosmic::command::message(crate::app::Message::PageMessage( match device { DeviceVariant::WiFi(device) => { crate::pages::Message::WiFi(wifi::Message::SelectDevice(device)) @@ -300,7 +300,7 @@ impl Page { ))); } - return cosmic::command::batch(commands); + return cosmic::Task::batch(tasks); } Message::UpdateDevices(devices) => { @@ -308,7 +308,7 @@ impl Page { } } - Command::none() + Task::none() } fn connect( @@ -319,7 +319,7 @@ impl Page { if self.nm_task.is_none() { self.nm_task = Some(crate::utils::forward_event_loop( sender, - |event| crate::pages::Message::Networking(event), + crate::pages::Message::Networking, move |mut tx| async move { let network_manager = match NetworkManager::new(&conn).await { Ok(n) => n, diff --git a/cosmic-settings/src/pages/networking/vpn/mod.rs b/cosmic-settings/src/pages/networking/vpn/mod.rs index 17dc755a..3ae5dccc 100644 --- a/cosmic-settings/src/pages/networking/vpn/mod.rs +++ b/cosmic-settings/src/pages/networking/vpn/mod.rs @@ -9,10 +9,9 @@ use anyhow::Context; use ashpd::desktop::file_chooser::FileFilter; use cosmic::{ iced::{alignment, Length}, - iced_core::text::Wrap, - prelude::CollectionWidget, + iced_core::text::Wrapping, widget::{self, icon}, - Apply, Command, Element, + Apply, Element, Task, }; use cosmic_settings_page::{self as page, section, Section}; use cosmic_settings_subscriptions::network_manager::{ @@ -140,7 +139,7 @@ impl VpnConnectionSettings { .map_or(false, |ct| match ct { ConnectionType::Password => true, }) - .then(|| self.password_flag) + .then_some(self.password_flag) .flatten() } } @@ -221,7 +220,7 @@ impl page::Page for Page { fn dialog(&self) -> Option> { self.dialog.as_ref().map(|dialog| match dialog { VpnDialog::Error(error_kind, message) => { - let reason = widget::text::body(message.as_str()).wrap(Wrap::Word); + let reason = widget::text::body(message.as_str()).wrapping(Wrapping::Word); let primary_action = widget::button::standard(fl!("ok")).on_press(Message::CancelDialog); @@ -331,7 +330,7 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { + ) -> cosmic::Task { if self.nm_task.is_none() { return cosmic::command::future(async move { zbus::Connection::system() @@ -344,10 +343,10 @@ impl page::Page for Page { }); } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.view_more_popup = None; self.nm_state = None; self.withheld_active_conns = None; @@ -358,12 +357,12 @@ impl page::Page for Page { _ = cancel.send(()); } - Command::none() + Task::none() } } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { let span = tracing::span!(tracing::Level::INFO, "vpn::update"); let _span = span.enter(); @@ -380,7 +379,7 @@ impl Page { if let Some(NmState { ref conn, .. }) = self.nm_state { let conn = conn.clone(); self.update_active_conns(state); - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ connection_settings(conn.clone()), update_devices(conn), ]); @@ -403,7 +402,7 @@ impl Page { network_manager::Event::ActiveConns | network_manager::Event::Devices, ) => { if let Some(NmState { ref conn, .. }) = self.nm_state { - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ update_state(conn.clone()), update_devices(conn.clone()), connection_settings(conn.clone()), @@ -427,7 +426,7 @@ impl Page { .collect(), }); - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ connection_settings(conn.clone()), update_devices(conn), ]); @@ -556,7 +555,7 @@ impl Page { Message::Refresh => { if let Some(NmState { ref conn, .. }) = self.nm_state { - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ update_state(conn.clone()), update_devices(conn.clone()), connection_settings(conn.clone()), @@ -575,7 +574,7 @@ impl Page { Message::ConnectWithPassword => { let Some(dialog) = self.dialog.take() else { - return Command::none(); + return Task::none(); }; if let VpnDialog::Password { @@ -624,7 +623,7 @@ impl Page { } } - Command::none() + Task::none() } fn activate_with_password( @@ -632,7 +631,7 @@ impl Page { connection_name: String, username: String, password: SecureString, - ) -> Command { + ) -> Task { cosmic::command::future(async move { if let Err(why) = nmcli::set_username(&connection_name, &username).await { return Message::Error(ErrorKind::WithPassword("username"), why.to_string()); @@ -773,13 +772,13 @@ fn devices_view() -> Section { ) }; - let identifier = widget::text::body(id).wrap(Wrap::Glyph); + let identifier = widget::text::body(id).wrapping(Wrapping::Glyph); let connect: Element<'_, Message> = if let Some(msg) = connect_msg { widget::button::text(connect_txt).on_press(msg).into() } else { widget::text::body(connect_txt) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .into() }; @@ -812,7 +811,7 @@ fn devices_view() -> Section { )) .width(Length::Fixed(200.0)) .apply(widget::container) - .style(cosmic::style::Container::Dialog) + .class(cosmic::style::Container::Dialog) }) .apply(|e| Some(Element::from(e))) } else { @@ -824,12 +823,12 @@ fn devices_view() -> Section { let controls = widget::row::with_capacity(2) .push(connect) .push_maybe(view_more) - .align_items(alignment::Alignment::Center) + .align_y(alignment::Alignment::Center) .spacing(spacing.space_xxs); let widget = widget::settings::item_row(vec![ identifier.into(), - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(Length::Fill).into(), controls.into(), ]); @@ -846,20 +845,20 @@ fn devices_view() -> Section { }) } -fn popup_button<'a>(message: Message, text: &'a str) -> Element<'a, Message> { +fn popup_button(message: Message, text: &str) -> Element<'_, Message> { let theme = cosmic::theme::active(); let theme = theme.cosmic(); widget::text::body(text) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .apply(widget::button::custom) .padding([theme.space_xxxs(), theme.space_xs()]) .width(Length::Fill) - .style(cosmic::theme::Button::MenuItem) + .class(cosmic::theme::Button::MenuItem) .on_press(message) .into() } -fn update_state(conn: zbus::Connection) -> Command { +fn update_state(conn: zbus::Connection) -> Task { cosmic::command::future(async move { match NetworkManagerState::new(&conn).await { Ok(state) => Message::UpdateState(state), @@ -868,7 +867,7 @@ fn update_state(conn: zbus::Connection) -> Command { }) } -fn update_devices(conn: zbus::Connection) -> Command { +fn update_devices(conn: zbus::Connection) -> Task { cosmic::command::future(async move { let filter = |device_type| matches!(device_type, network_manager::devices::DeviceType::WireGuard); @@ -880,9 +879,9 @@ fn update_devices(conn: zbus::Connection) -> Command { }) } -fn add_network() -> Command { +fn add_network() -> Task { let Some(dir) = dirs::download_dir().or_else(dirs::home_dir) else { - return Command::none(); + return Task::none(); }; cosmic::dialog::file_chooser::open::Dialog::new() @@ -935,7 +934,7 @@ fn add_network() -> Command { .apply(cosmic::command::future) } -fn connection_settings(conn: zbus::Connection) -> Command { +fn connection_settings(conn: zbus::Connection) -> Task { let settings = async move { let settings = network_manager::dbus::settings::NetworkManagerSettings::new(&conn).await?; diff --git a/cosmic-settings/src/pages/networking/vpn/nmcli.rs b/cosmic-settings/src/pages/networking/vpn/nmcli.rs index 8ab2dd6a..4d1c5147 100644 --- a/cosmic-settings/src/pages/networking/vpn/nmcli.rs +++ b/cosmic-settings/src/pages/networking/vpn/nmcli.rs @@ -15,7 +15,7 @@ pub async fn set_username(connection_name: &str, username: &str) -> Result<(), S pub async fn set_password_flags_none(connection_name: &str) -> Result<(), String> { tokio::process::Command::new("nmcli") - .args(&[ + .args([ "con", "mod", connection_name, @@ -30,10 +30,10 @@ pub async fn set_password_flags_none(connection_name: &str) -> Result<(), String pub async fn set_password(connection_name: &str, password: &str) -> Result<(), String> { tokio::process::Command::new("nmcli") - .args(&[ + .args([ "con", "mod", - &connection_name, + connection_name, "vpn.secrets", &format!("password={password}"), ]) diff --git a/cosmic-settings/src/pages/networking/wifi.rs b/cosmic-settings/src/pages/networking/wifi.rs index 30e6ffa4..c550e79c 100644 --- a/cosmic-settings/src/pages/networking/wifi.rs +++ b/cosmic-settings/src/pages/networking/wifi.rs @@ -9,10 +9,9 @@ use std::{ use anyhow::Context; use cosmic::{ iced::{alignment, Length}, - iced_core::text::Wrap, - prelude::CollectionWidget, + iced_core::text::Wrapping, widget::{self, icon}, - Apply, Command, Element, + Apply, Element, Task, }; use cosmic_settings_page::{self as page, section, Section}; use cosmic_settings_subscriptions::network_manager::{ @@ -199,9 +198,9 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { + ) -> cosmic::Task { if self.nm_task.is_none() { - return cosmic::command::future(async move { + return cosmic::Task::future(async move { zbus::Connection::system() .await .context("failed to create system dbus connection") @@ -213,10 +212,10 @@ impl page::Page for Page { }); } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.active_device = None; self.view_more_popup = None; self.nm_state = None; @@ -229,12 +228,12 @@ impl page::Page for Page { _ = cancel.send(()); } - Command::none() + Task::none() } } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { let span = tracing::span!(tracing::Level::INFO, "vpn::update"); let _span = span.enter(); @@ -295,7 +294,7 @@ impl Page { | network_manager::Event::WirelessAccessPoints, ) => { if let Some(NmState { ref conn, .. }) = self.nm_state { - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ update_state(conn.clone()), update_devices(conn.clone()), ]); @@ -353,7 +352,7 @@ impl Page { Message::ConnectWithPassword => { let Some(dialog) = self.dialog.take() else { - return Command::none(); + return Task::none(); }; if let WiFiDialog::Password { ssid, password, .. } = dialog { @@ -446,7 +445,7 @@ impl Page { } } - Command::none() + Task::none() } fn connect( @@ -532,10 +531,8 @@ fn devices_view() -> Section { let theme = cosmic::theme::active(); let spacing = &theme.cosmic().spacing; - let wifi_enable = - widget::settings::item::builder(§ion.descriptions[wifi_txt]).control( - widget::toggler(None, state.wifi_enabled, Message::WiFiEnable), - ); + let wifi_enable = widget::settings::item::builder(§ion.descriptions[wifi_txt]) + .control(widget::toggler(state.wifi_enabled).on_toggle(Message::WiFiEnable)); let mut view = widget::column::with_capacity(4) .push(widget::list_column().add(wifi_enable)) @@ -544,7 +541,7 @@ fn devices_view() -> Section { .push(icon::from_name("airplane-mode-symbolic")) .push(widget::text::body(§ion.descriptions[airplane_mode_txt])) .spacing(8) - .align_items(alignment::Alignment::Center) + .align_y(alignment::Alignment::Center) .apply(widget::container) .width(Length::Fill) .align_x(alignment::Horizontal::Center) @@ -612,14 +609,16 @@ fn devices_view() -> Section { is_encrypted .then(|| widget::icon::from_name("connection-secure-symbolic")), ) - .push(widget::text::body(network.ssid.as_ref()).wrap(Wrap::Glyph)) + .push( + widget::text::body(network.ssid.as_ref()).wrapping(Wrapping::Glyph), + ) .spacing(spacing.space_xxs); let connect: Element<'_, Message> = if let Some(msg) = connect_msg { widget::button::text(connect_txt).on_press(msg).into() } else { widget::text::body(connect_txt) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .into() }; @@ -654,7 +653,7 @@ fn devices_view() -> Section { })) .width(Length::Fixed(170.0)) .apply(widget::container) - .style(cosmic::style::Container::Dialog) + .class(cosmic::style::Container::Dialog) }) .apply(|e| Some(Element::from(e))) } else if is_known { @@ -668,12 +667,12 @@ fn devices_view() -> Section { let controls = widget::row::with_capacity(2) .push(connect) .push_maybe(view_more) - .align_items(alignment::Alignment::Center) + .align_y(alignment::Alignment::Center) .spacing(spacing.space_xxs); let widget = widget::settings::item_row(vec![ identifier.into(), - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(Length::Fill).into(), controls.into(), ]); @@ -714,20 +713,20 @@ fn is_connected(state: &NetworkManagerState, network: &AccessPoint) -> bool { }) } -fn popup_button<'a>(message: Message, text: &'a str) -> Element<'a, Message> { +fn popup_button(message: Message, text: &str) -> Element<'_, Message> { let theme = cosmic::theme::active(); let theme = theme.cosmic(); widget::text::body(text) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .apply(widget::button::custom) .padding([theme.space_xxxs(), theme.space_xs()]) .width(Length::Fill) - .style(cosmic::theme::Button::MenuItem) + .class(cosmic::theme::Button::MenuItem) .on_press(message) .into() } -fn connection_settings(conn: zbus::Connection) -> Command { +fn connection_settings(conn: zbus::Connection) -> Task { let settings = async move { let settings = network_manager::dbus::settings::NetworkManagerSettings::new(&conn).await?; @@ -785,7 +784,7 @@ fn connection_settings(conn: zbus::Connection) -> Command { }) } -pub fn update_state(conn: zbus::Connection) -> Command { +pub fn update_state(conn: zbus::Connection) -> Task { cosmic::command::future(async move { match NetworkManagerState::new(&conn).await { Ok(state) => Message::UpdateState(state), @@ -794,7 +793,7 @@ pub fn update_state(conn: zbus::Connection) -> Command { }) } -pub fn update_devices(conn: zbus::Connection) -> Command { +pub fn update_devices(conn: zbus::Connection) -> Task { cosmic::command::future(async move { let filter = |device_type| matches!(device_type, network_manager::devices::DeviceType::Wifi); diff --git a/cosmic-settings/src/pages/networking/wired.rs b/cosmic-settings/src/pages/networking/wired.rs index 4672fc1d..1731f6e1 100644 --- a/cosmic-settings/src/pages/networking/wired.rs +++ b/cosmic-settings/src/pages/networking/wired.rs @@ -6,10 +6,9 @@ use std::{collections::BTreeSet, sync::Arc}; use anyhow::Context; use cosmic::{ iced::{alignment, Length}, - iced_core::text::Wrap, - prelude::CollectionWidget, + iced_core::text::Wrapping, widget::{self, icon}, - Apply, Command, Element, + Apply, Element, Task, }; use cosmic_dbus_networkmanager::interface::enums::DeviceState; use cosmic_settings_page::{self as page, section, Section}; @@ -155,7 +154,7 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { + ) -> cosmic::Task { if self.nm_task.is_none() { return cosmic::command::future(async move { zbus::Connection::system() @@ -169,10 +168,10 @@ impl page::Page for Page { }); } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { self.active_device = None; self.view_more_popup = None; self.nm_state = None; @@ -184,7 +183,7 @@ impl page::Page for Page { _ = cancel.send(()); } - Command::none() + Task::none() } fn title(&self) -> Option<&str> { @@ -195,7 +194,7 @@ impl page::Page for Page { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { let span = tracing::span!(tracing::Level::INFO, "vpn::update"); let _span = span.enter(); @@ -232,7 +231,7 @@ impl Page { network_manager::Event::ActiveConns | network_manager::Event::Devices, ) => { if let Some(NmState { ref conn, .. }) = self.nm_state { - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ update_state(conn.clone()), update_devices(conn.clone()), ]); @@ -337,7 +336,7 @@ impl Page { Message::Refresh => { if let Some(NmState { ref conn, .. }) = self.nm_state { - return cosmic::command::batch(vec![ + return cosmic::Task::batch(vec![ update_state(conn.clone()), update_devices(conn.clone()), ]); @@ -357,7 +356,7 @@ impl Page { } } - Command::none() + Task::none() } fn connect( @@ -451,7 +450,7 @@ impl Page { device: &'a network_manager::devices::DeviceInfo, ) -> Element<'a, Message> { let has_multiple_connection_profiles = device.known_connections.len() > 1; - let header_txt = format!("{}", wired_conns_txt); + let header_txt = wired_conns_txt.to_string(); device .known_connections @@ -478,13 +477,13 @@ impl Page { ) }; - let identifier = widget::text::body(&connection.id).wrap(Wrap::Glyph); + let identifier = widget::text::body(&connection.id).wrapping(Wrapping::Glyph); let connect: Element<'_, Message> = if let Some(msg) = connect_msg { widget::button::text(connect_txt).on_press(msg).into() } else { widget::text::body(connect_txt) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .into() }; @@ -504,23 +503,23 @@ impl Page { .push_maybe(is_connected.then(|| { popup_button( Message::Deactivate(connection.uuid.clone()), - &disconnect_txt, + disconnect_txt, ) })) .push(popup_button( Message::Settings(connection.uuid.clone()), - &settings_txt, + settings_txt, )) .push_maybe(has_multiple_connection_profiles.then(|| { popup_button( Message::RemoveProfileRequest(connection.uuid.clone()), - &remove_txt, + remove_txt, ) })) .width(Length::Fixed(200.0)) .apply(widget::container) .padding(spacing.space_xxxs) - .style(cosmic::style::Container::Dialog) + .class(cosmic::style::Container::Dialog) }) .apply(|e| Some(Element::from(e))) } else { @@ -532,12 +531,12 @@ impl Page { let controls = widget::row::with_capacity(2) .push(connect) .push_maybe(view_more) - .align_items(alignment::Alignment::Center) + .align_y(alignment::Alignment::Center) .spacing(spacing.space_xxs); let widget = widget::settings::item_row(vec![ identifier.into(), - widget::horizontal_space(Length::Fill).into(), + widget::horizontal_space().width(Length::Fill).into(), controls.into(), ]); @@ -575,7 +574,7 @@ fn devices_view() -> Section { let active_device = page .active_device .as_ref() - .or_else(|| (nm_state.devices.len() == 1).then(|| nm_state.devices.get(0))?); + .or_else(|| (nm_state.devices.len() == 1).then(|| nm_state.devices.first())?); view = match active_device { Some(device) => view.push(page.device_view( @@ -600,20 +599,20 @@ fn devices_view() -> Section { }) } -fn popup_button<'a>(message: Message, text: &'a str) -> Element<'a, Message> { +fn popup_button(message: Message, text: &str) -> Element<'_, Message> { let theme = cosmic::theme::active(); let theme = theme.cosmic(); widget::text::body(text) - .vertical_alignment(alignment::Vertical::Center) + .align_y(alignment::Vertical::Center) .apply(widget::button::custom) .padding([theme.space_xxxs(), theme.space_xs()]) .width(Length::Fill) - .style(cosmic::theme::Button::MenuItem) + .class(cosmic::theme::Button::MenuItem) .on_press(message) .into() } -fn update_state(conn: zbus::Connection) -> Command { +fn update_state(conn: zbus::Connection) -> Task { cosmic::command::future(async move { match NetworkManagerState::new(&conn).await { Ok(state) => Message::UpdateState(state), @@ -622,7 +621,7 @@ fn update_state(conn: zbus::Connection) -> Command { }) } -fn update_devices(conn: zbus::Connection) -> Command { +fn update_devices(conn: zbus::Connection) -> Task { cosmic::command::future(async move { let filter = |device_type| matches!(device_type, network_manager::devices::DeviceType::Ethernet); diff --git a/cosmic-settings/src/pages/power/backend/mod.rs b/cosmic-settings/src/pages/power/backend/mod.rs index 2c97172d..b6d60d78 100644 --- a/cosmic-settings/src/pages/power/backend/mod.rs +++ b/cosmic-settings/src/pages/power/backend/mod.rs @@ -1,6 +1,6 @@ use chrono::{Duration, TimeDelta}; +use futures::future::join_all; use futures::FutureExt; -use futures::{future::join_all, TryFutureExt}; use upower_dbus::{BatteryState, BatteryType, DeviceProxy}; use zbus::Connection; @@ -403,34 +403,6 @@ impl Battery { } } -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_can_format_battery_remaining() { - let cases = [ - (59, "Less than a minute until empty"), - (300, "5 minutes until empty"), - (305, "5 minutes until empty"), - (330, "5 minutes until empty"), - (360, "6 minutes until empty"), - (3660, "1 hour and 1 minute until empty"), - (10800, "3 hours until empty"), - (969400, "11 days, 5 hours and 16 minutes until empty"), - ]; - for case in cases { - let (actual, expected) = case; - let battery = Battery { - remaining_duration: Duration::new(actual, 0).unwrap(), - is_charging: false, - ..Default::default() - }; - assert_eq!(battery.remaining_time(), expected); - } - } -} - impl ConnectedDevice { async fn from_device_maybe(proxy: DeviceProxy<'_>) -> Option { let device_type = proxy.type_().await.unwrap_or(BatteryType::Unknown); @@ -494,3 +466,31 @@ impl ConnectedDevice { vec![] } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_can_format_battery_remaining() { + let cases = [ + (59, "Less than a minute until empty"), + (300, "5 minutes until empty"), + (305, "5 minutes until empty"), + (330, "5 minutes until empty"), + (360, "6 minutes until empty"), + (3660, "1 hour and 1 minute until empty"), + (10800, "3 hours until empty"), + (969400, "11 days, 5 hours and 16 minutes until empty"), + ]; + for case in cases { + let (actual, expected) = case; + let battery = Battery { + remaining_duration: Duration::new(actual, 0).unwrap(), + is_charging: false, + ..Default::default() + }; + assert_eq!(battery.remaining_time(), expected); + } + } +} diff --git a/cosmic-settings/src/pages/power/mod.rs b/cosmic-settings/src/pages/power/mod.rs index 6f297e9c..a080b689 100644 --- a/cosmic-settings/src/pages/power/mod.rs +++ b/cosmic-settings/src/pages/power/mod.rs @@ -6,10 +6,9 @@ use backend::{Battery, ConnectedDevice, PowerProfile}; use chrono::TimeDelta; use cosmic::iced::{Alignment, Length}; use cosmic::iced_widget::{column, row}; -use cosmic::prelude::CollectionWidget; use cosmic::widget::{self, radio, settings, text}; use cosmic::Apply; -use cosmic::Command; +use cosmic::Task; use cosmic_settings_page::{self as page, section, Section}; use itertools::Itertools; use slab::Slab; @@ -43,19 +42,19 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> cosmic::Command { - let futures: Vec> = vec![ - cosmic::command::future(async move { + ) -> cosmic::Task { + let futures: Vec> = vec![ + cosmic::Task::future(async move { let battery = Battery::update_battery().await; Message::UpdateBattery(battery) }), - cosmic::command::future(async move { + cosmic::Task::future(async move { let devices = ConnectedDevice::update_connected_devices().await; Message::UpdateConnectedDevices(devices) }), ]; - cosmic::command::batch(futures).map(crate::pages::Message::Power) + cosmic::Task::batch(futures).map(crate::pages::Message::Power) } } @@ -106,7 +105,7 @@ fn battery_info() -> Section { .push(text::heading(§ion.title)) .push( row!(battery_icon, battery_label) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(cosmic::theme::active().cosmic().space_xxxs()), ) .into() @@ -146,18 +145,18 @@ fn connected_devices() -> Section { text::heading(&connected_device.model), row!(battery_icon, battery_percent_and_time) .spacing(4) - .align_items(Alignment::Center), + .align_y(Alignment::Center), ) .height(Length::Shrink) ) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .spacing(16) .padding([8, 16]) .width(Length::Fill) .height(Length::Fill), ) .height(64) - .style(cosmic::theme::Container::List) + .class(cosmic::theme::Container::List) .into() }) .collect(); @@ -173,15 +172,21 @@ fn connected_devices() -> Section { .chunks(2) .into_iter() .map(|mut device_row| { - row!( - device_row.next().unwrap_or( - widget::horizontal_space(Length::Fill).into() - ), - device_row.next().unwrap_or( - widget::horizontal_space(Length::Fill).into() - ), + cosmic::Element::from( + row!( + device_row.next().unwrap_or( + widget::horizontal_space() + .width(Length::Fill) + .into() + ), + device_row.next().unwrap_or( + widget::horizontal_space() + .width(Length::Fill) + .into() + ), + ) + .spacing(8), ) - .spacing(8) }), ) .spacing(8), @@ -217,7 +222,7 @@ fn profiles() -> Section { widget::column::with_capacity(2) .push(text::body(profile.title())) .push(text::caption(profile.description())), - profile.clone(), + profile, Some(current_profile), Message::PowerProfileChange, ) diff --git a/cosmic-settings/src/pages/sound.rs b/cosmic-settings/src/pages/sound.rs index 6b018a58..bc8d77ef 100644 --- a/cosmic-settings/src/pages/sound.rs +++ b/cosmic-settings/src/pages/sound.rs @@ -5,7 +5,7 @@ use std::{collections::BTreeMap, time::Duration}; use cosmic::{ widget::{self, settings}, - Command, Element, + Element, Task, }; use cosmic_settings_page::{self as page, section, Section}; use cosmic_settings_subscriptions::{pipewire, pulse}; @@ -127,7 +127,7 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { if self.pulse_thread.is_none() { let sender = sender.clone(); @@ -182,10 +182,10 @@ impl page::Page for Page { self.pipewire_thread = Some((cancel_tx, terminate)); } - Command::none() + Task::none() } - fn on_leave(&mut self) -> Command { + fn on_leave(&mut self) -> Task { if let Some(cancellation) = self.pulse_thread.take() { _ = cancellation.send(()); } @@ -197,7 +197,7 @@ impl page::Page for Page { *self = Page::default(); - Command::none() + Task::none() } } @@ -292,13 +292,13 @@ impl Page { } } - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::SourceVolumeChanged(volume) => { self.source_volume = volume; self.source_volume_text = volume.to_string(); if self.source_volume_debounce { - return Command::none(); + return Task::none(); } let mut command = None; @@ -316,8 +316,8 @@ impl Page { } Message::Pulse(pulse::Event::SourceVolume(volume)) => { - if self.source_volume_debounce { - return Command::none(); + if self.sink_volume_debounce { + return Task::none(); } self.source_volume = volume; @@ -328,7 +328,7 @@ impl Page { self.sink_volume = volume; self.sink_volume_text = volume.to_string(); if self.sink_volume_debounce { - return Command::none(); + return Task::none(); } let mut command = None; @@ -347,7 +347,7 @@ impl Page { Message::Pulse(pulse::Event::SinkVolume(volume)) => { if self.sink_volume_debounce { - return Command::none(); + return Task::none(); } self.sink_volume = volume; @@ -481,7 +481,7 @@ impl Page { self.active_sink = Some(pos); pactl_set_default_sink(device.identifier.clone()); self.set_default_sink(device.identifier.clone()); - return Command::none(); + return Task::none(); } } } @@ -496,7 +496,7 @@ impl Page { self.active_source = Some(pos); pactl_set_default_source(device.identifier.clone()); self.set_default_source(device.identifier.clone()); - return Command::none(); + return Task::none(); } } } @@ -592,7 +592,7 @@ impl Page { } } } - Command::none() + Task::none() } } @@ -609,7 +609,7 @@ fn input() -> Section { .descriptions(descriptions) .view::(move |_binder, page, section| { let volume_control = widget::row::with_capacity(3) - .align_items(cosmic::iced::Alignment::Center) + .align_y(cosmic::iced::Alignment::Center) .spacing(4) .push( widget::button::icon(widget::icon::from_name(if page.source_mute { @@ -667,7 +667,7 @@ fn output() -> Section { .descriptions(descriptions) .view::(move |_binder, page, section| { let volume_control = widget::row::with_capacity(3) - .align_items(cosmic::iced::Alignment::Center) + .align_y(cosmic::iced::Alignment::Center) .spacing(4) .push( widget::button::icon(if page.sink_mute { @@ -748,17 +748,17 @@ fn output() -> Section { fn sort_pulse_devices(descriptions: &mut Vec, node_ids: &mut Vec) { let mut tmp: Vec<(String, NodeId)> = std::mem::take(descriptions) .into_iter() - .zip(std::mem::take(node_ids).into_iter()) + .zip(std::mem::take(node_ids)) .collect(); - tmp.sort_unstable_by(|(ak, _), (bk, _)| ak.cmp(&bk)); + tmp.sort_unstable_by(|(ak, _), (bk, _)| ak.cmp(bk)); (*descriptions, *node_ids) = tmp.into_iter().collect(); } async fn pactl_set_card_profile(id: String, profile: String) { _ = tokio::process::Command::new("pactl") - .args(&["set-card-profile", id.as_str(), profile.as_str()]) + .args(["set-card-profile", id.as_str(), profile.as_str()]) .status() .await } @@ -766,7 +766,7 @@ async fn pactl_set_card_profile(id: String, profile: String) { fn pactl_set_default_sink(id: String) { tokio::task::spawn(async move { _ = tokio::process::Command::new("pactl") - .args(&["set-default-sink", id.as_str()]) + .args(["set-default-sink", id.as_str()]) .status() .await; }); @@ -775,7 +775,7 @@ fn pactl_set_default_sink(id: String) { fn pactl_set_default_source(id: String) { tokio::task::spawn(async move { _ = tokio::process::Command::new("pactl") - .args(&["set-default-source", id.as_str()]) + .args(["set-default-source", id.as_str()]) .status() .await; }); @@ -785,7 +785,7 @@ fn wpctl_set_mute(id: u32, mute: bool) { tokio::task::spawn(async move { let default = id.to_string(); _ = tokio::process::Command::new("wpctl") - .args(&["set-mute", default.as_str(), if mute { "1" } else { "0" }]) + .args(["set-mute", default.as_str(), if mute { "1" } else { "0" }]) .status() .await; }); @@ -796,7 +796,7 @@ fn wpctl_set_volume(id: u32, volume: u32) { let id = id.to_string(); let volume = format!("{}.{:02}", volume / 100, volume % 100); _ = tokio::process::Command::new("wpctl") - .args(&["set-volume", id.as_str(), volume.as_str()]) + .args(["set-volume", id.as_str(), volume.as_str()]) .status() .await; }); diff --git a/cosmic-settings/src/pages/system/about.rs b/cosmic-settings/src/pages/system/about.rs index fd937032..6ece254b 100644 --- a/cosmic-settings/src/pages/system/about.rs +++ b/cosmic-settings/src/pages/system/about.rs @@ -4,7 +4,7 @@ use cosmic_settings_page::{self as page, section, Section}; use cosmic::widget::{editable_input, list_column, settings, text}; -use cosmic::{command, Apply, Command}; +use cosmic::{Apply, Task}; use cosmic_settings_system::about::Info; use slab::Slab; use slotmap::SlotMap; @@ -47,10 +47,10 @@ impl page::Page for Page { &mut self, _page: page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { - command::future(async move { - crate::pages::Message::About(Message::Info(Box::new(Info::load()))) - }) + ) -> Task { + Task::future( + async move { crate::pages::Message::About(Message::Info(Box::new(Info::load()))) }, + ) } } diff --git a/cosmic-settings/src/pages/time/date.rs b/cosmic-settings/src/pages/time/date.rs index b68060b5..7d2ea3c2 100644 --- a/cosmic-settings/src/pages/time/date.rs +++ b/cosmic-settings/src/pages/time/date.rs @@ -7,9 +7,9 @@ use chrono::{Datelike, Timelike}; use cosmic::{ cosmic_config::{self, ConfigGet, ConfigSet}, iced::Length, - iced_core::text::Wrap, + iced_core::text::Wrapping, widget::{self, dropdown, settings}, - Apply, Command, Element, + Apply, Element, Task, }; use cosmic_settings_page::Section; use cosmic_settings_page::{self as page, section}; @@ -133,8 +133,8 @@ impl page::Page for Page { &mut self, _page: cosmic_settings_page::Entity, _sender: tokio::sync::mpsc::Sender, - ) -> Command { - cosmic::command::future(async move { + ) -> Task { + cosmic::Task::future(async move { let client = match zbus::Connection::system().await { Ok(client) => client, Err(why) => { @@ -174,7 +174,7 @@ impl page::Page for Page { } impl Page { - pub fn update(&mut self, message: Message) -> Command { + pub fn update(&mut self, message: Message) -> Task { match message { Message::TimezoneContext => { self.timezone_search.clear(); @@ -229,7 +229,7 @@ impl Page { self.timezone = Some(timezone_id); if let Some(timezone) = self.timezone_list.get(timezone_id).cloned() { - return cosmic::command::future(async move { + return cosmic::Task::future(async move { let client = match zbus::Connection::system().await { Ok(client) => client, Err(why) => { @@ -278,7 +278,7 @@ impl Page { Message::None => (), } - Command::none() + Task::none() } fn set_ntp(&mut self, enable: bool) { @@ -333,11 +333,11 @@ impl Page { fn timezone_context_item<'a>(&self, id: usize, timezone: &'a str) -> Element<'a, Message> { widget::button::custom(widget::settings::item_row(vec![ - widget::text::body(timezone).wrap(Wrap::Word).into(), - widget::horizontal_space(Length::Fill).into(), + widget::text::body(timezone).wrapping(Wrapping::Word).into(), + widget::horizontal_space().width(Length::Fill).into(), ])) .on_press(Message::Timezone(id)) - .style(cosmic::theme::Button::Icon) + .class(cosmic::theme::Button::Icon) .into() } @@ -460,13 +460,13 @@ fn timezone() -> Section { .map(|id| &*page.timezone_list[id]) .unwrap_or_default(), ) - .wrap(Wrap::Word), + .wrapping(Wrapping::Word), ) .push(widget::icon::from_name("go-next-symbolic").size(16).icon()) .apply(widget::container) - .style(cosmic::theme::Container::List) + .class(cosmic::theme::Container::List) .apply(widget::button::custom) - .style(cosmic::theme::Button::Transparent) + .class(cosmic::theme::Button::Transparent) .on_press(Message::TimezoneContext); settings::section() diff --git a/cosmic-settings/src/subscription/bluetooth.rs b/cosmic-settings/src/subscription/bluetooth.rs index 2ec577bc..3b505f76 100644 --- a/cosmic-settings/src/subscription/bluetooth.rs +++ b/cosmic-settings/src/subscription/bluetooth.rs @@ -9,14 +9,14 @@ use cosmic::iced::{ use futures::{channel::mpsc, stream::FusedStream}; use zbus::zvariant::OwnedObjectPath; -enum DevicePropertyWatcherCommand { +enum DevicePropertyWatcherTask { Add(OwnedObjectPath), Removed(OwnedObjectPath), } struct DevicePropertyWatcher<'a> { stream: futures::stream::SelectAll>, - rx: mpsc::Receiver, + rx: mpsc::Receiver, } struct SignalWatcher<'a> { @@ -39,7 +39,7 @@ impl<'a> futures::Stream for SignalWatcher<'a> { } impl<'a> DevicePropertyWatcher<'a> { - fn new() -> (Self, mpsc::Sender) { + fn new() -> (Self, mpsc::Sender) { let stream = futures::stream::select_all(vec![]); let (tx, rx) = mpsc::channel(10); @@ -87,7 +87,7 @@ pub async fn watch(mut tx: futures::channel::mpsc::Sender) { .receive_interfaces_removed() .await?; - let (mut property_watcher, mut property_watcher_command) = DevicePropertyWatcher::new(); + let (mut property_watcher, mut property_watcher_task) = DevicePropertyWatcher::new(); for (path, interfaces) in managed_object_proxy.get_managed_objects().await? { if interfaces.contains_key("org.bluez.Device1") @@ -100,11 +100,11 @@ pub async fn watch(mut tx: futures::channel::mpsc::Sender) { while !property_watcher.rx.is_terminated() { futures::select! { - command = property_watcher.rx.next() => match command { - Some(DevicePropertyWatcherCommand::Add(path)) => { + Task = property_watcher.rx.next() => match Task { + Some(DevicePropertyWatcherTask::Add(path)) => { property_watcher.insert(&connection, path).await?; } - Some(DevicePropertyWatcherCommand::Removed(path)) => { + Some(DevicePropertyWatcherTask::Removed(path)) => { property_watcher = property_watcher.remove(&path); } None => { @@ -139,8 +139,8 @@ pub async fn watch(mut tx: futures::channel::mpsc::Sender) { Ok(device) => { match bluetooth::Device::from_device(&device).await { Ok(device) => { - property_watcher_command - .send(DevicePropertyWatcherCommand::Add(args.object_path.to_owned().into())).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; + property_watcher_task + .send(DevicePropertyWatcherTask::Add(args.object_path.to_owned().into())).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; tx .send(bluetooth::Message::AddedDevice(args.object_path.to_owned().into(), device)) @@ -165,7 +165,7 @@ pub async fn watch(mut tx: futures::channel::mpsc::Sender) { Some(signal) => { let args = signal.args()?; if args.interfaces.contains(&"org.bluez.Device1") { - property_watcher_command.send(DevicePropertyWatcherCommand::Removed( + property_watcher_task.send(DevicePropertyWatcherTask::Removed( args.object_path.to_owned().into(), )).await.map_err(|e| zbus::Error::Failure(e.to_string()))?; tx diff --git a/cosmic-settings/src/subscription/daytime.rs b/cosmic-settings/src/subscription/daytime.rs index c077fdbe..ce937219 100644 --- a/cosmic-settings/src/subscription/daytime.rs +++ b/cosmic-settings/src/subscription/daytime.rs @@ -3,20 +3,23 @@ use std::any::TypeId; use ashpd::desktop::location::{Location, LocationProxy}; use chrono::Datelike; use cosmic::iced::{ - self, futures::{channel::mpsc::Sender, future, SinkExt, StreamExt}, + stream, Subscription, }; use sunrise::sunrise_sunset; use tokio::select; pub fn daytime() -> cosmic::iced::Subscription { struct Sunset; - iced::subscription::channel(TypeId::of::(), 2, |tx| async { - if let Err(err) = inner(tx).await { - tracing::error!("Sunset subscription error: {:?}", err); - } - future::pending().await - }) + Subscription::run_with_id( + TypeId::of::(), + stream::channel(2, |tx| async { + if let Err(err) = inner(tx).await { + tracing::error!("Sunset subscription error: {:?}", err); + } + future::pending().await + }), + ) } enum Event { diff --git a/cosmic-settings/src/subscription/desktop_files.rs b/cosmic-settings/src/subscription/desktop_files.rs index b4971513..46ebc7d1 100644 --- a/cosmic-settings/src/subscription/desktop_files.rs +++ b/cosmic-settings/src/subscription/desktop_files.rs @@ -1,5 +1,5 @@ use cosmic::{ - iced::subscription, + iced::{stream, Subscription}, iced_futures::futures::{self, SinkExt}, }; use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher}; @@ -25,13 +25,16 @@ pub enum DesktopFileEvent { pub fn desktop_files( id: I, ) -> cosmic::iced::Subscription { - subscription::channel(id, 50, move |mut output| async move { - let mut state = State::Ready; + Subscription::run_with_id( + id, + stream::channel(50, move |mut output| async move { + let mut state = State::Ready; - loop { - state = start_watching(state, &mut output).await; - } - }) + loop { + state = start_watching(state, &mut output).await; + } + }), + ) } async fn start_watching( diff --git a/cosmic-settings/src/theme.rs b/cosmic-settings/src/theme.rs index 766ca737..ce465c0e 100644 --- a/cosmic-settings/src/theme.rs +++ b/cosmic-settings/src/theme.rs @@ -4,10 +4,10 @@ use cosmic::{iced_core::Border, theme}; #[must_use] -pub fn display_container_frame() -> cosmic::theme::Container { +pub fn display_container_frame() -> cosmic::theme::Container<'static> { theme::Container::custom(|theme| { let cosmic = theme.cosmic(); - cosmic::widget::container::Appearance { + cosmic::widget::container::Style { icon_color: None, text_color: None, background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::WHITE)), @@ -22,10 +22,10 @@ pub fn display_container_frame() -> cosmic::theme::Container { } #[must_use] -pub fn display_container_screen() -> cosmic::theme::Container { +pub fn display_container_screen() -> cosmic::theme::Container<'static> { theme::Container::custom(|theme| { let cosmic = theme.cosmic(); - cosmic::widget::container::Appearance { + cosmic::widget::container::Style { icon_color: None, text_color: None, background: Some(cosmic::iced::Background::Color(cosmic::iced::Color::BLACK)), diff --git a/cosmic-settings/src/widget/mod.rs b/cosmic-settings/src/widget/mod.rs index 59808444..31c17a02 100644 --- a/cosmic-settings/src/widget/mod.rs +++ b/cosmic-settings/src/widget/mod.rs @@ -5,8 +5,7 @@ use std::borrow::Cow; use cosmic::cosmic_theme::Spacing; use cosmic::iced::{alignment, Length}; -use cosmic::iced_core::text::Wrap; -use cosmic::prelude::CollectionWidget; +use cosmic::iced_core::text::Wrapping; use cosmic::widget::color_picker::ColorPickerUpdate; use cosmic::widget::{ self, button, column, container, divider, horizontal_space, icon, row, settings, text, @@ -44,7 +43,7 @@ pub fn color_picker_context_view<'a, Message: Clone + 'static>( .align_x(alignment::Horizontal::Center), ) .padding(spacing.space_l) - .align_items(cosmic::iced_core::Alignment::Center) + .align_x(cosmic::iced_core::Alignment::Center) .spacing(spacing.space_m) .width(Length::Fill) .apply(Element::from) @@ -76,21 +75,21 @@ pub fn search_header( .into(), ); - column_children.push(vertical_space(Length::Fixed(8.)).into()); + column_children.push(vertical_space().height(Length::Fixed(8.)).into()); column_children.push(divider::horizontal::heavy().into()); column::with_children(column_children).into() } pub fn search_page_link(title: &str) -> button::TextButton { - button::text(title).style(button::Style::Link) + button::text(title).class(button::ButtonClass::Link) } #[must_use] pub fn page_title(page: &page::Info) -> Element { row::with_capacity(2) .push(text::title3(page.title.as_str())) - .push(horizontal_space(Length::Fill)) + .push(horizontal_space().width(Length::Fill)) .into() } @@ -104,15 +103,15 @@ pub fn unimplemented_page() -> Element<'static, Message> { #[must_use] pub fn display_container<'a, Message: 'a>(widget: Element<'a, Message>) -> Element<'a, Message> { let display = container(widget) - .style(crate::theme::display_container_screen()) + .class(crate::theme::display_container_screen()) .apply(container) .padding(4) - .style(crate::theme::display_container_frame()); + .class(crate::theme::display_container_frame()); row::with_capacity(3) - .push(horizontal_space(Length::Fill)) + .push(horizontal_space().width(Length::Fill)) .push(display) - .push(horizontal_space(Length::Fill)) + .push(horizontal_space().width(Length::Fill)) .padding([0, 0, 8, 0]) .into() } @@ -148,17 +147,17 @@ pub fn page_list_item<'a, Message: 'static + Clone>( row::with_capacity(2) .push(text::body(info)) .push(container(icon::from_name("go-next-symbolic").size(20)).padding(8)) - .align_items(alignment::Alignment::Center), + .align_y(alignment::Alignment::Center), ) .padding(0) .spacing(space_xxs) .apply(container) .padding([space_s, space_m]) .align_x(alignment::Horizontal::Center) - .style(theme::Container::List) + .class(theme::Container::List) .apply(button::custom) .padding(0) - .style(theme::Button::Transparent) + .class(theme::Button::Transparent) .on_press(message) .into() } @@ -174,7 +173,7 @@ pub fn sub_page_header<'a, Message: 'static + Clone>( .padding(0) .label(parent_page) .spacing(4) - .style(button::Style::Link) + .class(button::ButtonClass::Link) .on_press(on_press); let sub_page_header = row::with_capacity(2).push(text::title3(sub_page)); @@ -189,14 +188,14 @@ pub fn sub_page_header<'a, Message: 'static + Clone>( pub fn go_next_item(description: &str, msg: Msg) -> cosmic::Element<'_, Msg> { settings::item_row(vec![ - text::body(description).wrap(Wrap::Word).into(), - horizontal_space(Length::Fill).into(), + text::body(description).wrapping(Wrapping::Word).into(), + horizontal_space().width(Length::Fill).into(), icon::from_name("go-next-symbolic").size(16).icon().into(), ]) .apply(widget::container) - .style(cosmic::theme::Container::List) + .class(cosmic::theme::Container::List) .apply(button::custom) - .style(theme::Button::Transparent) + .class(theme::Button::Transparent) .on_press(msg) .into() } @@ -207,19 +206,19 @@ pub fn go_next_with_item<'a, Msg: Clone + 'static>( msg: Msg, ) -> cosmic::Element<'_, Msg> { settings::item_row(vec![ - text::body(description).wrap(Wrap::Word).into(), - horizontal_space(Length::Fill).into(), + text::body(description).wrapping(Wrapping::Word).into(), + horizontal_space().width(Length::Fill).into(), widget::row::with_capacity(2) .push(item) .push(icon::from_name("go-next-symbolic").size(16).icon()) - .align_items(alignment::Alignment::Center) + .align_y(alignment::Alignment::Center) .spacing(cosmic::theme::active().cosmic().spacing.space_s) .into(), ]) .apply(widget::container) - .style(cosmic::theme::Container::List) + .class(cosmic::theme::Container::List) .apply(button::custom) - .style(theme::Button::Transparent) + .class(theme::Button::Transparent) .on_press(msg) .into() } diff --git a/page/src/binder.rs b/page/src/binder.rs index 235828c8..2d273f57 100644 --- a/page/src/binder.rs +++ b/page/src/binder.rs @@ -3,8 +3,8 @@ use crate::section::{self, Section}; use crate::{Content, Info, Page}; -use cosmic::iced_runtime::command::Command; use cosmic::Element; +use cosmic::Task; use regex::Regex; use slotmap::{SecondaryMap, SlotMap, SparseSecondaryMap}; use std::{ @@ -157,8 +157,8 @@ impl Binder { page.downcast_mut::

() } - /// Returns a command when a page is left - pub fn on_leave(&mut self, id: crate::Entity) -> Option> { + /// Returns a Task when a page is left + pub fn on_leave(&mut self, id: crate::Entity) -> Option> { if let Some(page) = self.page.get_mut(id) { return Some(page.on_leave()); } @@ -170,12 +170,12 @@ impl Binder { &mut self, id: crate::Entity, sender: tokio::sync::mpsc::Sender, - ) -> Command { + ) -> Task { if let Some(page) = self.page.get_mut(id) { return page.on_enter(id, sender); } - Command::none() + Task::none() } #[must_use] diff --git a/page/src/lib.rs b/page/src/lib.rs index ca4dbc7c..0ff51267 100644 --- a/page/src/lib.rs +++ b/page/src/lib.rs @@ -5,7 +5,7 @@ mod binder; pub use binder::{AutoBind, Binder}; mod insert; -use cosmic::{Command, Element}; +use cosmic::{Element, Task}; use downcast_rs::{impl_downcast, Downcast}; pub use insert::Insert; @@ -54,8 +54,8 @@ pub trait Page: Downcast { } /// Response from a file chooser dialog request. - fn file_chooser(&mut self, _selected: Vec) -> Command { - Command::none() + fn file_chooser(&mut self, _selected: Vec) -> Task { + Task::none() } /// Alter the contents of the page's header view. @@ -63,19 +63,19 @@ pub trait Page: Downcast { None } - /// Reload page metadata via a Command. + /// Reload page metadata via a Task. #[allow(unused)] fn on_enter( &mut self, page: crate::Entity, sender: tokio::sync::mpsc::Sender, - ) -> Command { - Command::none() + ) -> Task { + Task::none() } /// Emit a command when the page is left - fn on_leave(&mut self) -> Command { - Command::none() + fn on_leave(&mut self) -> Task { + Task::none() } /// The title to display in the page header.