diff --git a/Cargo.lock b/Cargo.lock index 13ccc226..3ca60ab1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,9 +189,9 @@ checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" [[package]] name = "atomic_refcell" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112ef6b3f6cb3cb6fc5b6b494ef7a848492cff1ab0ef4de10b0f7d572861c905" +checksum = "76f2bfe491d41d45507b8431da8274f7feeca64a49e86d980eed2937ec2ff020" [[package]] name = "atomicwrites" @@ -372,7 +372,7 @@ dependencies = [ "bitflags 2.4.0", "log", "polling", - "rustix 0.38.14", + "rustix 0.38.15", "slab", "thiserror", ] @@ -528,7 +528,7 @@ dependencies = [ "i18n-embed-fl", "iced_tiny_skia", "id_tree", - "indexmap 2.0.1", + "indexmap 2.0.2", "keyframe", "lazy_static", "libcosmic", @@ -571,7 +571,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "atomicwrites", "calloop 0.12.2", @@ -586,7 +586,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "quote", "syn 1.0.109", @@ -627,7 +627,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "almost", "cosmic-config", @@ -889,7 +889,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.0", + "libloading 0.8.1", ] [[package]] @@ -1096,9 +1096,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "exr" -version = "1.71.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" dependencies = [ "bit_field", "flume", @@ -1281,10 +1281,14 @@ dependencies = [ [[package]] name = "flume" -version = "0.11.0" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project", "spin", ] @@ -1300,7 +1304,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "674e258f4b5d2dcd63888c01c68413c51f565e8af99d2f7701c7b81d79ef41c4" dependencies = [ - "roxmltree 0.18.0", + "roxmltree 0.18.1", ] [[package]] @@ -1524,8 +1528,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1649,6 +1655,12 @@ dependencies = [ "bitflags 2.4.0", ] +[[package]] +name = "grid" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df00eed8d1f0db937f6be10e46e8072b0671accb504cf0f959c5c52c679f5b9" + [[package]] name = "guillotiere" version = "0.6.2" @@ -1661,10 +1673,11 @@ dependencies = [ [[package]] name = "half" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" +checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" dependencies = [ + "cfg-if", "crunchy", ] @@ -1802,7 +1815,7 @@ dependencies = [ [[package]] name = "iced" version = "0.10.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "iced_core", "iced_futures", @@ -1815,7 +1828,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.10.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "bitflags 1.3.2", "instant", @@ -1828,7 +1841,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.7.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "futures", "iced_core", @@ -1840,7 +1853,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.9.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1858,7 +1871,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -1871,7 +1884,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.1.1" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "iced_core", "iced_futures", @@ -1881,7 +1894,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.9.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "iced_core", "once_cell", @@ -1891,7 +1904,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "bytemuck", "cosmic-text", @@ -1909,7 +1922,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.11.1" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1931,7 +1944,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.1.3" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "iced_renderer", "iced_runtime", @@ -2010,9 +2023,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", "hashbrown 0.14.1", @@ -2243,7 +2256,7 @@ checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?rev=188b7c2b#188b7c2bbc35d0e9f1e218f52c1dc9cf89490744" +source = "git+https://github.com/pop-os/libcosmic/?rev=f91287d#f91287dec2297df41a339c1106850c4cf179f67f" dependencies = [ "apply", "cosmic-config", @@ -2263,6 +2276,7 @@ dependencies = [ "lazy_static", "palette", "slotmap", + "taffy", "thiserror", "tracing", "unicode-segmentation", @@ -2281,9 +2295,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -2351,9 +2365,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "locale_config" @@ -2481,9 +2495,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memmap2" @@ -2613,6 +2627,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom", +] + [[package]] name = "natord" version = "1.0.9" @@ -3164,6 +3187,26 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -3197,14 +3240,14 @@ dependencies = [ [[package]] name = "polling" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7571075a670bb8e02350c4d1c27d934aabdce416aa91a95d58dc9e21267dad3c" +checksum = "62a79e457c9898100b4298d57d69ec53d06f9a6ed352431ce5f377e082d2e846" dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.14", + "rustix 0.38.15", "tracing", "windows-sys 0.48.0", ] @@ -3462,13 +3505,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.5" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.8", + "regex-automata 0.3.9", "regex-syntax 0.7.5", ] @@ -3483,9 +3526,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -3605,9 +3648,9 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f595a457b6b8c6cda66a48503e92ee8d19342f905948f29c383200ec9eb1d8" +checksum = "862340e351ce1b271a378ec53f304a5558f7db87f3769dc655a8f6ecbb68b302" dependencies = [ "xmlparser", ] @@ -3684,14 +3727,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.14" +version = "0.38.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" +checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.7", + "linux-raw-sys 0.4.8", "windows-sys 0.48.0", ] @@ -3900,11 +3943,11 @@ dependencies = [ "gbm", "gl_generator", "glow 0.12.3", - "indexmap 2.0.1", + "indexmap 2.0.2", "input", "lazy_static", "libc", - "libloading 0.8.0", + "libloading 0.8.1", "libseat", "nix 0.27.1", "once_cell", @@ -4110,6 +4153,17 @@ dependencies = [ "libc", ] +[[package]] +name = "taffy" +version = "0.3.11" +source = "git+https://github.com/DioxusLabs/taffy#65bedf128ec8cef40c1a21b6f141f2c771842cca" +dependencies = [ + "arrayvec", + "grid", + "num-traits", + "slotmap", +] + [[package]] name = "tempfile" version = "3.8.0" @@ -4119,7 +4173,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.14", + "rustix 0.38.15", "windows-sys 0.48.0", ] @@ -4312,7 +4366,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.1", + "indexmap 2.0.2", "toml_datetime", "winnow", ] @@ -4323,7 +4377,7 @@ version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca676d9ba1a322c1b64eb8045a5ec5c0cfb0c9d08e15e9ff622589ad5221c8fe" dependencies = [ - "indexmap 2.0.1", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -4615,7 +4669,7 @@ dependencies = [ "imagesize 0.12.0", "kurbo 0.9.5", "log", - "roxmltree 0.18.0", + "roxmltree 0.18.1", "simplecss", "siphasher", "svgtypes 0.11.0", @@ -5089,7 +5143,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.0", + "libloading 0.8.1", "log", "metal", "naga", @@ -5471,9 +5525,9 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "xmlparser" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" [[package]] name = "xmlwriter" diff --git a/Cargo.toml b/Cargo.toml index 6f8f1fba..c2dcc9db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,10 @@ libsystemd = { version = "0.5", optional = true } wayland-backend = "0.3.0" wayland-scanner = "0.31.0" cosmic-comp-config = { path = "cosmic-comp-config" } -cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "188b7c2b", features = ["calloop"] } +cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", features = ["calloop"] } cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "main", default-features = false, features = ["server"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "188b7c2b", default-features = false } -iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "188b7c2b" } +libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", default-features = false } +iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d" } tiny-skia = "0.10" ordered-float = "3.0" glow = "0.11.2" diff --git a/src/shell/element/resize_indicator.rs b/src/shell/element/resize_indicator.rs index a180120f..4752a68b 100644 --- a/src/shell/element/resize_indicator.rs +++ b/src/shell/element/resize_indicator.rs @@ -7,13 +7,13 @@ use crate::{ utils::iced::{IcedElement, Program}, }; -use apply::Apply; use calloop::LoopHandle; use cosmic::{ iced::widget::{column, container, horizontal_space, row, vertical_space}, iced_core::{Background, Color, Length}, theme, - widget::{icon, text}, + widget::{icon::from_name, text}, + Apply, }; use smithay::utils::Size; @@ -64,26 +64,29 @@ impl Program for ResizeIndicatorInternal { fn view(&self) -> crate::utils::iced::Element<'_, Self::Message> { let edges = self.edges.lock().unwrap(); + let icon_container_style = || { + theme::Container::custom(|theme| container::Appearance { + icon_color: Some(Color::from(theme.cosmic().accent.on)), + text_color: Some(Color::from(theme.cosmic().accent.on)), + background: Some(Background::Color(theme.cosmic().accent_color().into())), + border_radius: 18.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + }) + }; + column(vec![ if edges.contains(ResizeEdge::TOP) { - icon( - if self.direction == ResizeDirection::Outwards { - "go-up-symbolic" - } else { - "go-down-symbolic" - }, - 32, - ) - .force_svg(true) + from_name(if self.direction == ResizeDirection::Outwards { + "go-up-symbolic" + } else { + "go-down-symbolic" + }) + .size(32) + .prefer_svg(true) .apply(container) .padding(2) - .style(theme::Container::custom(|theme| container::Appearance { - text_color: Some(Color::from(theme.cosmic().accent.on)), - background: Some(Background::Color(theme.cosmic().accent_color().into())), - border_radius: 18.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - })) + .style(icon_container_style()) .width(Length::Shrink) .apply(container) .center_x() @@ -94,24 +97,16 @@ impl Program for ResizeIndicatorInternal { }, row(vec![ if edges.contains(ResizeEdge::LEFT) { - icon( - if self.direction == ResizeDirection::Outwards { - "go-previous-symbolic" - } else { - "go-next-symbolic" - }, - 32, - ) - .force_svg(true) + from_name(if self.direction == ResizeDirection::Outwards { + "go-previous-symbolic" + } else { + "go-next-symbolic" + }) + .size(32) + .prefer_svg(true) .apply(container) .padding(4) - .style(theme::Container::custom(|theme| container::Appearance { - text_color: Some(Color::from(theme.cosmic().accent.on)), - background: Some(Background::Color(theme.cosmic().accent_color().into())), - border_radius: 18.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - })) + .style(icon_container_style()) .width(Length::Shrink) .apply(container) .center_y() @@ -144,13 +139,7 @@ impl Program for ResizeIndicatorInternal { .center_y() .padding(16) .apply(container) - .style(theme::Container::custom(|theme| container::Appearance { - text_color: Some(Color::from(theme.cosmic().accent.on)), - background: Some(Background::Color(theme.cosmic().accent_color().into())), - border_radius: 18.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - })) + .style(icon_container_style()) .width(Length::Shrink) .height(Length::Shrink) .apply(container) @@ -160,24 +149,16 @@ impl Program for ResizeIndicatorInternal { .center_y() .into(), if edges.contains(ResizeEdge::RIGHT) { - icon( - if self.direction == ResizeDirection::Outwards { - "go-next-symbolic" - } else { - "go-previous-symbolic" - }, - 32, - ) - .force_svg(true) + from_name(if self.direction == ResizeDirection::Outwards { + "go-next-symbolic" + } else { + "go-previous-symbolic" + }) + .size(32) + .prefer_svg(true) .apply(container) .padding(4) - .style(theme::Container::custom(|theme| container::Appearance { - text_color: Some(Color::from(theme.cosmic().accent.on)), - background: Some(Background::Color(theme.cosmic().accent_color().into())), - border_radius: 18.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - })) + .style(icon_container_style()) .height(Length::Shrink) .apply(container) .center_y() @@ -191,24 +172,16 @@ impl Program for ResizeIndicatorInternal { .height(Length::Fill) .into(), if edges.contains(ResizeEdge::BOTTOM) { - icon( - if self.direction == ResizeDirection::Outwards { - "go-down-symbolic" - } else { - "go-up-symbolic" - }, - 32, - ) - .force_svg(true) + from_name(if self.direction == ResizeDirection::Outwards { + "go-down-symbolic" + } else { + "go-up-symbolic" + }) + .size(32) + .prefer_svg(true) .apply(container) .padding(4) - .style(theme::Container::custom(|theme| container::Appearance { - text_color: Some(Color::from(theme.cosmic().accent.on)), - background: Some(Background::Color(theme.cosmic().accent_color().into())), - border_radius: 18.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - })) + .style(icon_container_style()) .width(Length::Shrink) .apply(container) .center_x() diff --git a/src/shell/element/stack.rs b/src/shell/element/stack.rs index 29279f9e..04e333ec 100644 --- a/src/shell/element/stack.rs +++ b/src/shell/element/stack.rs @@ -8,14 +8,13 @@ use crate::{ utils::prelude::SeatExt, wayland::handlers::screencopy::ScreencopySessions, }; -use apply::Apply; use calloop::LoopHandle; use cosmic::{ iced::{id::Id, widget as iced_widget}, iced_core::{Background, BorderRadius, Color, Length}, iced_runtime::Command, iced_widget::scrollable::AbsoluteOffset, - theme, widget as cosmic_widget, Element as CosmicElement, + theme, widget as cosmic_widget, Apply, Element as CosmicElement, }; use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::InputType; use once_cell::sync::Lazy; @@ -652,8 +651,10 @@ impl Program for CosmicStackInternal { let group_focused = self.group_focused.load(Ordering::SeqCst); let elements = vec![ - cosmic_widget::icon("window-stack-symbolic", 16) - .force_svg(true) + cosmic_widget::icon::from_name("window-stack-symbolic") + .size(16) + .prefer_svg(true) + .icon() .style(if group_focused { theme::Svg::custom(|theme| iced_widget::svg::Appearance { color: Some(if theme.cosmic().is_dark { @@ -663,7 +664,7 @@ impl Program for CosmicStackInternal { }), }) } else { - theme::Svg::Symbolic + theme::Svg::Default }) .apply(iced_widget::container) .padding([4, 24]) @@ -712,6 +713,7 @@ impl Program for CosmicStackInternal { .center_y() .style(if self.group_focused.load(Ordering::SeqCst) { theme::Container::custom(|theme| iced_widget::container::Appearance { + icon_color: Some(Color::from(theme.cosmic().background.on)), text_color: Some(Color::from(theme.cosmic().background.on)), background: Some(Background::Color(theme.cosmic().accent_color().into())), border_radius: BorderRadius::from([8.0, 8.0, 0.0, 0.0]), @@ -720,6 +722,7 @@ impl Program for CosmicStackInternal { }) } else { theme::Container::custom(|theme| iced_widget::container::Appearance { + icon_color: Some(Color::from(theme.cosmic().background.on)), text_color: Some(Color::from(theme.cosmic().background.on)), background: Some(Background::Color(theme.cosmic().palette.neutral_3.into())), border_radius: BorderRadius::from([8.0, 8.0, 0.0, 0.0]), diff --git a/src/shell/element/stack/tab.rs b/src/shell/element/stack/tab.rs index de5023da..48b9933e 100644 --- a/src/shell/element/stack/tab.rs +++ b/src/shell/element/stack/tab.rs @@ -1,10 +1,7 @@ -use apply::Apply; use cosmic::{ font::Font, iced::{ - widget::{ - self, container::draw_background, rule::FillMode, text::StyleSheet as TextStyleSheet, - }, + widget::{self, container::draw_background, rule::FillMode}, Element, }, iced_core::{ @@ -13,6 +10,7 @@ use cosmic::{ mouse, overlay, renderer, widget::{ operation::{Operation, OperationOutputWrapper}, + text::StyleSheet as TextStyleSheet, tree::Tree, Id, Widget, }, @@ -22,9 +20,10 @@ use cosmic::{ button::StyleSheet as ButtonStyleSheet, container::StyleSheet as ContainerStyleSheet, rule::StyleSheet as RuleStyleSheet, }, - iced_widget::scrollable::AbsoluteOffset, + iced_widget::{scrollable::AbsoluteOffset, text}, theme, - widget::{icon, text, Icon}, + widget::{icon::from_name, Icon}, + Apply, }; use super::tab_text::tab_text; @@ -82,6 +81,7 @@ impl Into for TabBackgroundTheme { match self { Self::ActiveActivated => { theme::Container::custom(move |theme| widget::container::Appearance { + icon_color: Some(Color::from(theme.cosmic().accent_text_color())), text_color: Some(Color::from(theme.cosmic().accent_text_color())), background: Some(background_color), border_radius: 0.0.into(), @@ -91,6 +91,7 @@ impl Into for TabBackgroundTheme { } Self::ActiveDeactivated => { theme::Container::custom(move |_theme| widget::container::Appearance { + icon_color: None, text_color: None, background: Some(background_color), border_radius: 0.0.into(), @@ -113,9 +114,9 @@ pub trait TabMessage: Clone { fn scrolled() -> Self; } -pub struct Tab<'a, Message: TabMessage> { +pub struct Tab { id: Id, - app_icon: Icon<'a>, + app_icon: Icon, title: String, font: Font, close_message: Option, @@ -125,11 +126,11 @@ pub struct Tab<'a, Message: TabMessage> { active: bool, } -impl<'a, Message: TabMessage> Tab<'a, Message> { +impl Tab { pub fn new(title: impl Into, app_id: impl Into, id: Id) -> Self { Tab { id, - app_icon: icon(app_id.into(), 16), + app_icon: from_name(app_id.into()).size(16).icon(), title: title.into(), font: cosmic::font::FONT, close_message: None, @@ -175,25 +176,27 @@ impl<'a, Message: TabMessage> Tab<'a, Message> { self } - pub(super) fn internal(self, idx: usize) -> TabInternal<'a, Message, Renderer> + pub(super) fn internal<'a, Renderer>(self, idx: usize) -> TabInternal<'a, Message, Renderer> where Renderer: cosmic::iced_core::Renderer + 'a, Renderer: cosmic::iced_core::text::Renderer, - Renderer::Theme: ButtonStyleSheet