From 6a644fe5b45ea4d201bddc60a9431d0013f0b5a5 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 27 Dec 2023 19:11:29 -0500 Subject: [PATCH 1/4] fix: check the cosmic icon theme and don't filter out apps without an app id --- cosmic-app-list/src/app.rs | 39 +++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index 7fedfd1d..87738d51 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -53,6 +53,7 @@ use itertools::Itertools; use rand::{thread_rng, Rng}; use std::borrow::Cow; use std::collections::HashMap; +use std::path::Path; use std::path::PathBuf; use std::str::FromStr; use std::time::Duration; @@ -278,11 +279,18 @@ fn desktop_info_for_app_ids(mut app_ids: Vec) -> Vec { if let Some(i) = app_ids.iter().position(|s| { s == de.appid || s.eq(&de.startup_wm_class().unwrap_or_default()) }) { - let icon = freedesktop_icons::lookup(de.icon().unwrap_or(de.appid)) - .with_size(128) - .with_cache() - .find() - .unwrap_or_else(default_app_icon); + // check if absolute path exists and otherwise treat it as a name + let icon_path = Path::new(de.icon().unwrap_or(de.appid)); + let icon = if icon_path.is_absolute() && icon_path.exists() { + icon_path.into() + } else { + freedesktop_icons::lookup(de.icon().unwrap_or(de.appid)) + .with_size(128) + .with_theme("Cosmic") + .with_cache() + .find() + .unwrap_or_else(default_app_icon) + }; app_ids.remove(i); Some(DesktopInfo { @@ -719,10 +727,7 @@ impl cosmic::Application for CosmicAppList { .map(cosmic::app::message::app); } WaylandUpdate::Toplevel(event) => match event { - ToplevelUpdate::Add(handle, info) => { - if info.app_id.is_empty() { - return Command::none(); - } + ToplevelUpdate::Add(handle, mut info) => { if let Some(t) = self .active_list .iter_mut() @@ -734,9 +739,21 @@ impl cosmic::Application for CosmicAppList { { t.toplevels.push((handle, info)); } else { - let desktop_info = - desktop_info_for_app_ids(vec![info.app_id.clone()]).remove(0); + if info.app_id.is_empty() { + info.app_id = format!("Unknown Application {}", self.item_ctr); + } self.item_ctr += 1; + let desktop_info = + desktop_info_for_app_ids(vec![info.app_id.clone()]) + .pop() + .unwrap_or_else(|| DesktopInfo { + id: info.app_id.clone(), + wm_class: None, + icon: default_app_icon(), + exec: String::new(), + name: info.app_id.clone(), + path: PathBuf::new(), + }); self.active_list.push(DockItem { id: self.item_ctr, toplevels: vec![(handle, info)], From af62f12f6a9d4d5d06afd973546b52aa922cfd42 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 2 Jan 2024 11:47:58 -0500 Subject: [PATCH 2/4] wip: fix icons --- Cargo.lock | 554 ++++++++++++++++++++++++++++++++----- cosmic-app-list/Cargo.toml | 4 +- cosmic-app-list/src/app.rs | 90 +++--- 3 files changed, 531 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e5bb530..5318406a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,7 +768,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.12.0", - "libcosmic", + "libcosmic 0.1.0", "log", "nix 0.26.4", "once_cell", @@ -792,7 +792,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "libpulse-binding", "libpulse-glib-binding", "mpris2-zbus", @@ -814,7 +814,7 @@ dependencies = [ "futures", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "log", "once_cell", "pretty_env_logger 0.5.0", @@ -836,7 +836,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.10.5", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "log", "once_cell", "pretty_env_logger 0.5.0", @@ -852,7 +852,7 @@ version = "0.1.0" dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "once_cell", "rust-embed 6.8.1", "tracing", @@ -871,7 +871,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.10.5", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "log", "pretty_env_logger 0.5.0", "rust-embed 6.8.1", @@ -892,7 +892,7 @@ dependencies = [ "cosmic-time", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "nix 0.26.4", "ron", "rust-embed 6.8.1", @@ -912,7 +912,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "libpulse-binding", "libpulse-glib-binding", "logind-zbus", @@ -929,7 +929,7 @@ name = "cosmic-applet-status-area" version = "0.1.0" dependencies = [ "futures", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "serde", "tokio", "zbus", @@ -942,7 +942,7 @@ dependencies = [ "cosmic-time", "i18n-embed 0.14.1", "i18n-embed-fl 0.7.0", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "once_cell", "rust-embed 8.1.0", "tracing", @@ -956,7 +956,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "nix 0.26.4", "once_cell", "rust-embed 6.8.1", @@ -973,7 +973,7 @@ dependencies = [ "futures", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "log", "nix 0.26.4", "once_cell", @@ -992,17 +992,31 @@ dependencies = [ "wayland-client 0.31.1", ] +[[package]] +name = "cosmic-config" +version = "0.1.0" +dependencies = [ + "atomicwrites", + "cosmic-config-derive 0.1.0", + "dirs 5.0.1", + "iced_futures 0.12.0", + "notify", + "once_cell", + "ron", + "serde", +] + [[package]] name = "cosmic-config" version = "0.1.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ "atomicwrites", - "cosmic-config-derive", + "cosmic-config-derive 0.1.0 (git+https://github.com/pop-os/libcosmic)", "cosmic-settings-daemon", "dirs 5.0.1", "futures-util", - "iced_futures", + "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", "notify", "once_cell", "ron", @@ -1010,6 +1024,14 @@ dependencies = [ "zbus", ] +[[package]] +name = "cosmic-config-derive" +version = "0.1.0" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "cosmic-config-derive" version = "0.1.0" @@ -1038,7 +1060,7 @@ name = "cosmic-notifications-config" version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-notifications#4775bc063e61db18f3e1d3c6d6a1405b1e11a92b" dependencies = [ - "cosmic-config", + "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", "serde", ] @@ -1060,7 +1082,7 @@ name = "cosmic-panel-button" version = "0.1.0" dependencies = [ "freedesktop-desktop-entry", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", ] [[package]] @@ -1069,7 +1091,7 @@ version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-panel#dcfa3eaf124571d039320d0dd9da6ae00743b153" dependencies = [ "anyhow", - "cosmic-config", + "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", "ron", "serde", "tracing", @@ -1104,7 +1126,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" dependencies = [ - "fontdb", + "fontdb 0.15.0", "libm", "log", "rangemap", @@ -1119,13 +1141,47 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cosmic-text" +version = "0.10.0" +source = "git+https://github.com/pop-os/cosmic-text.git?branch=refactor#8fc93d90933ded737ea4f7ca63ab064a5331710d" +dependencies = [ + "bitflags 2.4.1", + "fontdb 0.16.0", + "libm", + "log", + "rangemap", + "rustc-hash", + "rustybuzz 0.12.1", + "self_cell 1.0.2", + "swash", + "sys-locale", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", +] + +[[package]] +name = "cosmic-theme" +version = "0.1.0" +dependencies = [ + "almost", + "cosmic-config 0.1.0", + "csscolorparser", + "lazy_static", + "palette", + "ron", + "serde", +] + [[package]] name = "cosmic-theme" version = "0.1.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ "almost", - "cosmic-config", + "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", "csscolorparser", "lazy_static", "palette", @@ -1139,7 +1195,7 @@ version = "0.4.0" source = "git+https://github.com/pop-os/cosmic-time#4dc1fcec44aa7471a8e707fa391f9882d23250d7" dependencies = [ "float-cmp", - "libcosmic", + "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", "once_cell", ] @@ -1915,7 +1971,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "674e258f4b5d2dcd63888c01c68413c51f565e8af99d2f7701c7b81d79ef41c4" dependencies = [ - "roxmltree", + "roxmltree 0.18.1", ] [[package]] @@ -1932,6 +1988,20 @@ dependencies = [ "ttf-parser 0.19.2", ] +[[package]] +name = "fontdb" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b88c54a38407f7352dd2c4238830115a6377741098ffd1f997c813d0e088a6" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.9.0", + "slotmap", + "tinyvec", + "ttf-parser 0.20.0", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -2284,12 +2354,23 @@ dependencies = [ "gl_generator", ] +[[package]] +name = "glyphon" +version = "0.3.0" +source = "git+https://github.com/jackpot51/glyphon.git?branch=refactor#c28dc99c86b6b598633e6623096b21632f266976" +dependencies = [ + "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", + "etagere", + "lru", + "wgpu", +] + [[package]] name = "glyphon" version = "0.3.0" source = "git+https://github.com/grovesNL/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85#2caa9fc5e5923c1d827d177c3619cab7e9885b85" dependencies = [ - "cosmic-text", + "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "etagere", "lru", "wgpu", @@ -2603,21 +2684,43 @@ dependencies = [ "cc", ] +[[package]] +name = "iced" +version = "0.12.0" +dependencies = [ + "iced_accessibility 0.1.0", + "iced_core 0.12.0", + "iced_futures 0.12.0", + "iced_renderer 0.12.0", + "iced_sctk 0.1.0", + "iced_widget 0.12.0", + "image", + "thiserror", +] + [[package]] name = "iced" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ - "iced_accessibility", - "iced_core", - "iced_futures", - "iced_renderer", - "iced_sctk", - "iced_widget", + "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_sctk 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "iced_widget 0.12.0 (git+https://github.com/pop-os/libcosmic)", "image", "thiserror", ] +[[package]] +name = "iced_accessibility" +version = "0.1.0" +dependencies = [ + "accesskit", + "accesskit_unix", +] + [[package]] name = "iced_accessibility" version = "0.1.0" @@ -2627,13 +2730,30 @@ dependencies = [ "accesskit_unix", ] +[[package]] +name = "iced_core" +version = "0.12.0" +dependencies = [ + "bitflags 1.3.2", + "iced_accessibility 0.1.0", + "instant", + "log", + "num-traits", + "palette", + "raw-window-handle", + "serde", + "smithay-client-toolkit 0.18.0", + "thiserror", + "xxhash-rust", +] + [[package]] name = "iced_core" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ "bitflags 1.3.2", - "iced_accessibility", + "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", "instant", "log", "num-traits", @@ -2645,19 +2765,53 @@ dependencies = [ "xxhash-rust", ] +[[package]] +name = "iced_futures" +version = "0.12.0" +dependencies = [ + "futures", + "iced_core 0.12.0", + "log", + "tokio", + "wasm-bindgen-futures", + "wasm-timer", +] + [[package]] name = "iced_futures" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ "futures", - "iced_core", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", "log", "tokio", "wasm-bindgen-futures", "wasm-timer", ] +[[package]] +name = "iced_graphics" +version = "0.12.0" +dependencies = [ + "bitflags 1.3.2", + "bytemuck", + "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", + "glam", + "half", + "iced_core 0.12.0", + "image", + "kamadak-exif", + "log", + "lyon_path", + "once_cell", + "raw-window-handle", + "rustc-hash", + "thiserror", + "unicode-segmentation", + "xxhash-rust", +] + [[package]] name = "iced_graphics" version = "0.12.0" @@ -2665,10 +2819,10 @@ source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c dependencies = [ "bitflags 1.3.2", "bytemuck", - "cosmic-text", + "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "glam", "half", - "iced_core", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", "image", "kamadak-exif", "log", @@ -2681,29 +2835,75 @@ dependencies = [ "xxhash-rust", ] +[[package]] +name = "iced_renderer" +version = "0.12.0" +dependencies = [ + "iced_graphics 0.12.0", + "iced_tiny_skia 0.12.0", + "iced_wgpu 0.12.0", + "log", + "raw-window-handle", + "thiserror", +] + [[package]] name = "iced_renderer" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ - "iced_graphics", - "iced_tiny_skia", - "iced_wgpu", + "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_tiny_skia 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_wgpu 0.12.0 (git+https://github.com/pop-os/libcosmic)", "log", "raw-window-handle", "thiserror", ] +[[package]] +name = "iced_runtime" +version = "0.12.0" +dependencies = [ + "iced_accessibility 0.1.0", + "iced_core 0.12.0", + "iced_futures 0.12.0", + "smithay-client-toolkit 0.18.0", + "thiserror", +] + [[package]] name = "iced_runtime" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ - "iced_accessibility", - "iced_core", - "iced_futures", + "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "smithay-client-toolkit 0.18.0", + "thiserror", +] + +[[package]] +name = "iced_sctk" +version = "0.1.0" +dependencies = [ + "enum-repr", + "float-cmp", + "futures", + "iced_futures 0.12.0", + "iced_graphics 0.12.0", + "iced_runtime 0.12.0", + "iced_style 0.12.0", + "itertools 0.10.5", + "lazy_static", + "raw-window-handle", "smithay-client-toolkit 0.18.0", + "smithay-clipboard", "thiserror", + "tracing", + "wayland-backend 0.3.2", + "wayland-protocols 0.31.0", + "xkeysym", ] [[package]] @@ -2714,10 +2914,10 @@ dependencies = [ "enum-repr", "float-cmp", "futures", - "iced_futures", - "iced_graphics", - "iced_runtime", - "iced_style", + "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", "itertools 0.10.5", "lazy_static", "raw-window-handle", @@ -2730,34 +2930,79 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "iced_style" +version = "0.12.0" +dependencies = [ + "iced_core 0.12.0", + "once_cell", + "palette", +] + [[package]] name = "iced_style" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ - "iced_core", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", "once_cell", "palette", ] +[[package]] +name = "iced_tiny_skia" +version = "0.12.0" +dependencies = [ + "bytemuck", + "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", + "iced_graphics 0.12.0", + "kurbo", + "log", + "raw-window-handle", + "resvg 0.37.0", + "rustc-hash", + "softbuffer", + "tiny-skia", + "xxhash-rust", +] + [[package]] name = "iced_tiny_skia" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ "bytemuck", - "cosmic-text", - "iced_graphics", + "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", "kurbo", "log", "raw-window-handle", - "resvg", + "resvg 0.36.0", "rustc-hash", "softbuffer", "tiny-skia", "xxhash-rust", ] +[[package]] +name = "iced_wgpu" +version = "0.12.0" +dependencies = [ + "bitflags 1.3.2", + "bytemuck", + "futures", + "glam", + "glyphon 0.3.0 (git+https://github.com/jackpot51/glyphon.git?branch=refactor)", + "guillotiere", + "iced_graphics 0.12.0", + "log", + "lyon", + "once_cell", + "raw-window-handle", + "resvg 0.37.0", + "wgpu", +] + [[package]] name = "iced_wgpu" version = "0.12.0" @@ -2767,25 +3012,39 @@ dependencies = [ "bytemuck", "futures", "glam", - "glyphon", + "glyphon 0.3.0 (git+https://github.com/grovesNL/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85)", "guillotiere", - "iced_graphics", + "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", "log", "lyon", "once_cell", "raw-window-handle", - "resvg", + "resvg 0.36.0", "wgpu", ] +[[package]] +name = "iced_widget" +version = "0.12.0" +dependencies = [ + "iced_renderer 0.12.0", + "iced_runtime 0.12.0", + "iced_style 0.12.0", + "num-traits", + "ouroboros", + "smithay-client-toolkit 0.18.0", + "thiserror", + "unicode-segmentation", +] + [[package]] name = "iced_widget" version = "0.12.0" source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" dependencies = [ - "iced_renderer", - "iced_runtime", - "iced_style", + "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", "num-traits", "ouroboros", "smithay-client-toolkit 0.18.0", @@ -3046,6 +3305,42 @@ version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +[[package]] +name = "libcosmic" +version = "0.1.0" +dependencies = [ + "apply", + "ashpd", + "cosmic-client-toolkit", + "cosmic-config 0.1.0", + "cosmic-panel-config", + "cosmic-theme 0.1.0", + "css-color", + "derive_setters", + "fraction", + "freedesktop-icons", + "iced 0.12.0", + "iced_core 0.12.0", + "iced_futures 0.12.0", + "iced_renderer 0.12.0", + "iced_runtime 0.12.0", + "iced_sctk 0.1.0", + "iced_style 0.12.0", + "iced_tiny_skia 0.12.0", + "iced_widget 0.12.0", + "lazy_static", + "palette", + "ron", + "slotmap", + "taffy", + "thiserror", + "tokio", + "tracing", + "unicode-segmentation", + "url", + "zbus", +] + [[package]] name = "libcosmic" version = "0.1.0" @@ -3054,23 +3349,23 @@ dependencies = [ "apply", "ashpd", "cosmic-client-toolkit", - "cosmic-config", + "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", "cosmic-panel-config", "cosmic-settings-daemon", - "cosmic-theme", + "cosmic-theme 0.1.0 (git+https://github.com/pop-os/libcosmic)", "css-color", "derive_setters", "fraction", "freedesktop-icons", - "iced", - "iced_core", - "iced_futures", - "iced_renderer", - "iced_runtime", - "iced_sctk", - "iced_style", - "iced_tiny_skia", - "iced_widget", + "iced 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_sctk 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_tiny_skia 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_widget 0.12.0 (git+https://github.com/pop-os/libcosmic)", "lazy_static", "nix 0.27.1", "palette", @@ -4266,9 +4561,26 @@ dependencies = [ "pico-args", "png", "rgb", - "svgtypes", + "svgtypes 0.12.0", "tiny-skia", - "usvg", + "usvg 0.36.0", +] + +[[package]] +name = "resvg" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadccb3d99a9efb8e5e00c16fbb732cbe400db2ec7fc004697ee7d97d86cf1f4" +dependencies = [ + "gif", + "jpeg-decoder", + "log", + "pico-args", + "png", + "rgb", + "svgtypes 0.13.0", + "tiny-skia", + "usvg 0.37.0", ] [[package]] @@ -4301,6 +4613,12 @@ dependencies = [ "xmlparser", ] +[[package]] +name = "roxmltree" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" + [[package]] name = "rust-embed" version = "6.8.1" @@ -4457,6 +4775,23 @@ dependencies = [ "unicode-script", ] +[[package]] +name = "rustybuzz" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" +dependencies = [ + "bitflags 2.4.1", + "bytemuck", + "libm", + "smallvec", + "ttf-parser 0.20.0", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + [[package]] name = "ryu" version = "1.0.16" @@ -4834,6 +5169,16 @@ dependencies = [ "siphasher", ] +[[package]] +name = "svgtypes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e44e288cd960318917cbd540340968b90becc8bc81f171345d706e7a89d9d70" +dependencies = [ + "kurbo", + "siphasher", +] + [[package]] name = "swash" version = "0.1.8" @@ -5392,9 +5737,24 @@ dependencies = [ "base64", "log", "pico-args", - "usvg-parser", - "usvg-text-layout", - "usvg-tree", + "usvg-parser 0.36.0", + "usvg-text-layout 0.36.0", + "usvg-tree 0.36.0", + "xmlwriter", +] + +[[package]] +name = "usvg" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b0a51b72ab80ca511d126b77feeeb4fb1e972764653e61feac30adc161a756" +dependencies = [ + "base64", + "log", + "pico-args", + "usvg-parser 0.37.0", + "usvg-text-layout 0.37.0", + "usvg-tree 0.37.0", "xmlwriter", ] @@ -5409,11 +5769,29 @@ dependencies = [ "imagesize", "kurbo", "log", - "roxmltree", + "roxmltree 0.18.1", + "simplecss", + "siphasher", + "svgtypes 0.12.0", + "usvg-tree 0.36.0", +] + +[[package]] +name = "usvg-parser" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd4e3c291f45d152929a31f0f6c819245e2921bfd01e7bd91201a9af39a2bdc" +dependencies = [ + "data-url", + "flate2", + "imagesize", + "kurbo", + "log", + "roxmltree 0.19.0", "simplecss", "siphasher", - "svgtypes", - "usvg-tree", + "svgtypes 0.13.0", + "usvg-tree 0.37.0", ] [[package]] @@ -5422,14 +5800,30 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d2374378cb7a3fb8f33894e0fdb8625e1bbc4f25312db8d91f862130b541593" dependencies = [ - "fontdb", + "fontdb 0.15.0", "kurbo", "log", "rustybuzz 0.10.0", "unicode-bidi", "unicode-script", "unicode-vo", - "usvg-tree", + "usvg-tree 0.36.0", +] + +[[package]] +name = "usvg-text-layout" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d383a3965de199d7f96d4e11a44dd859f46e86de7f3dca9a39bf82605da0a37c" +dependencies = [ + "fontdb 0.16.0", + "kurbo", + "log", + "rustybuzz 0.12.1", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "usvg-tree 0.37.0", ] [[package]] @@ -5440,7 +5834,19 @@ checksum = "6cacb0c5edeaf3e80e5afcf5b0d4004cc1d36318befc9a7c6606507e5d0f4062" dependencies = [ "rctree", "strict-num", - "svgtypes", + "svgtypes 0.12.0", + "tiny-skia-path", +] + +[[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 0.13.0", "tiny-skia-path", ] diff --git a/cosmic-app-list/Cargo.toml b/cosmic-app-list/Cargo.toml index 13ce17e2..2417bc27 100644 --- a/cosmic-app-list/Cargo.toml +++ b/cosmic-app-list/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] cctk.workspace = true cosmic-protocols.workspace = true -libcosmic.workspace = true -# libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio"] } +# libcosmic.workspace = true +libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio", "applet"] } ron = "0.8" futures = "0.3" futures-util = "0.3" diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index 87738d51..6133e5b8 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -24,6 +24,7 @@ use cosmic::iced::widget::vertical_space; use cosmic::iced::widget::{column, dnd_source, mouse_area, row, Column, Row}; use cosmic::iced::Color; use cosmic::iced::{window, Subscription}; +use cosmic::iced_core::window::Icon; use cosmic::iced_runtime::core::alignment::Horizontal; use cosmic::iced_runtime::core::event; use cosmic::iced_sctk::commands::data_device::accept_mime_type; @@ -115,8 +116,9 @@ impl DockItem { .. } = self; - let cosmic_icon = cosmic::widget::icon::from_path(PathBuf::from(&desktop_info.icon)) - .icon() + let cosmic_icon = desktop_info + .icon + .as_cosmic_icon() .size(applet.suggested_size().0); let dot_radius = 2; @@ -244,32 +246,46 @@ enum Message { ConfigUpdated(AppListConfig), } +#[derive(Debug, Clone, PartialEq, Eq)] +pub(crate) enum IconSource { + Name(String), + Path(PathBuf), +} + +impl IconSource { + fn from_unknown(icon: &str) -> Self { + let icon_path = Path::new(icon); + if icon_path.is_absolute() && icon_path.exists() { + Self::Path(icon_path.into()) + } else { + Self::Name(icon.into()) + } + } + + fn as_cosmic_icon(&self) -> cosmic::widget::icon::Icon { + match self { + Self::Name(name) => cosmic::widget::icon::from_name(name.as_str()).into(), + Self::Path(path) => cosmic::widget::icon(cosmic::widget::icon::from_path(path.clone())), + } + } +} + +impl Default for IconSource { + fn default() -> Self { + Self::Name("application-default".to_string()) + } +} + #[derive(Debug, Clone, Default)] struct DesktopInfo { id: String, wm_class: Option, - icon: PathBuf, + icon: IconSource, exec: String, name: String, path: PathBuf, } -fn default_app_icon() -> PathBuf { - freedesktop_icons::lookup("application-default") - .with_theme("Cosmic") - .force_svg() - .with_cache() - .find() - .or_else(|| { - freedesktop_icons::lookup("application-x-executable") - .with_theme("default") - .with_size(128) - .with_cache() - .find() - }) - .unwrap_or_default() -} - fn desktop_info_for_app_ids(mut app_ids: Vec) -> Vec { let app_ids_clone = app_ids.clone(); let mut ret = freedesktop_desktop_entry::Iter::new(freedesktop_desktop_entry::default_paths()) @@ -280,16 +296,12 @@ fn desktop_info_for_app_ids(mut app_ids: Vec) -> Vec { s == de.appid || s.eq(&de.startup_wm_class().unwrap_or_default()) }) { // check if absolute path exists and otherwise treat it as a name - let icon_path = Path::new(de.icon().unwrap_or(de.appid)); + let icon = de.icon().unwrap_or(de.appid); + let icon_path = Path::new(icon); let icon = if icon_path.is_absolute() && icon_path.exists() { - icon_path.into() + IconSource::Path(icon_path.into()) } else { - freedesktop_icons::lookup(de.icon().unwrap_or(de.appid)) - .with_size(128) - .with_theme("Cosmic") - .with_cache() - .find() - .unwrap_or_else(default_app_icon) + IconSource::Name(icon.into()) }; app_ids.remove(i); @@ -313,7 +325,7 @@ fn desktop_info_for_app_ids(mut app_ids: Vec) -> Vec { .into_iter() .map(|id| DesktopInfo { id, - icon: default_app_icon(), + icon: IconSource::default(), ..Default::default() }) .collect_vec(), @@ -630,21 +642,16 @@ impl cosmic::Application for CosmicAppList { Message::DndData(file_path) => { if let Some(DndOffer { dock_item, .. }) = self.dnd_offer.as_mut() { if let Some(di) = std::fs::read_to_string(&file_path).ok().and_then(|input| { - DesktopEntry::decode(&file_path, &input).ok().map(|de| { - let icon = freedesktop_icons::lookup(de.icon().unwrap_or(de.appid)) - .with_size(128) - .with_cache() - .find() - .unwrap_or_else(default_app_icon); - DesktopInfo { + DesktopEntry::decode(&file_path, &input) + .ok() + .map(|de| DesktopInfo { id: de.id().to_string(), wm_class: de.startup_wm_class().map(ToString::to_string), - icon, + icon: IconSource::from_unknown(de.icon().unwrap_or(de.appid)), exec: de.exec().unwrap_or_default().to_string(), name: de.name(None).unwrap_or_default().to_string(), path: file_path.clone(), - } - }) + }) }) { self.item_ctr += 1; *dock_item = Some(DockItem::new(self.item_ctr, Vec::new(), di)); @@ -749,7 +756,7 @@ impl cosmic::Application for CosmicAppList { .unwrap_or_else(|| DesktopInfo { id: info.app_id.clone(), wm_class: None, - icon: default_app_icon(), + icon: IconSource::default(), exec: String::new(), name: info.app_id.clone(), path: PathBuf::new(), @@ -1031,8 +1038,9 @@ impl cosmic::Application for CosmicAppList { fn view_window(&self, id: window::Id) -> Element { if let Some((_, item, _)) = self.dnd_source.as_ref().filter(|s| s.0 == id) { - cosmic::widget::icon::from_path(PathBuf::from(&item.desktop_info.icon)) - .icon() + item.desktop_info + .icon + .as_cosmic_icon() .size(self.core.applet.suggested_size().0) .into() } else if let Some(( From 4bb8812a6ea73627292ce4555cc7df9ea3747c14 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 3 Jan 2024 13:47:52 -0500 Subject: [PATCH 3/4] fix: use libcosmic icon with fallbacks --- Cargo.lock | 610 ++++++------------------------------- cosmic-app-list/Cargo.toml | 4 +- cosmic-app-list/src/app.rs | 7 +- 3 files changed, 102 insertions(+), 519 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5318406a..5c4a26df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,7 +768,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.12.0", - "libcosmic 0.1.0", + "libcosmic", "log", "nix 0.26.4", "once_cell", @@ -792,7 +792,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "libpulse-binding", "libpulse-glib-binding", "mpris2-zbus", @@ -814,7 +814,7 @@ dependencies = [ "futures", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "log", "once_cell", "pretty_env_logger 0.5.0", @@ -836,7 +836,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.10.5", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "log", "once_cell", "pretty_env_logger 0.5.0", @@ -852,7 +852,7 @@ version = "0.1.0" dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "once_cell", "rust-embed 6.8.1", "tracing", @@ -871,7 +871,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "itertools 0.10.5", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "log", "pretty_env_logger 0.5.0", "rust-embed 6.8.1", @@ -892,7 +892,7 @@ dependencies = [ "cosmic-time", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "nix 0.26.4", "ron", "rust-embed 6.8.1", @@ -912,7 +912,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "libpulse-binding", "libpulse-glib-binding", "logind-zbus", @@ -929,7 +929,7 @@ name = "cosmic-applet-status-area" version = "0.1.0" dependencies = [ "futures", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "serde", "tokio", "zbus", @@ -942,7 +942,7 @@ dependencies = [ "cosmic-time", "i18n-embed 0.14.1", "i18n-embed-fl 0.7.0", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "once_cell", "rust-embed 8.1.0", "tracing", @@ -956,7 +956,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "icon-loader", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "nix 0.26.4", "once_cell", "rust-embed 6.8.1", @@ -973,7 +973,7 @@ dependencies = [ "futures", "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "log", "nix 0.26.4", "once_cell", @@ -995,28 +995,14 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "atomicwrites", - "cosmic-config-derive 0.1.0", - "dirs 5.0.1", - "iced_futures 0.12.0", - "notify", - "once_cell", - "ron", - "serde", -] - -[[package]] -name = "cosmic-config" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "atomicwrites", - "cosmic-config-derive 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-config-derive", "cosmic-settings-daemon", "dirs 5.0.1", "futures-util", - "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_futures", "notify", "once_cell", "ron", @@ -1027,15 +1013,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cosmic-config-derive" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "quote", "syn 1.0.109", @@ -1060,7 +1038,7 @@ name = "cosmic-notifications-config" version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-notifications#4775bc063e61db18f3e1d3c6d6a1405b1e11a92b" dependencies = [ - "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-config", "serde", ] @@ -1082,7 +1060,7 @@ name = "cosmic-panel-button" version = "0.1.0" dependencies = [ "freedesktop-desktop-entry", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", ] [[package]] @@ -1091,7 +1069,7 @@ version = "0.1.0" source = "git+https://github.com/pop-os/cosmic-panel#dcfa3eaf124571d039320d0dd9da6ae00743b153" dependencies = [ "anyhow", - "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-config", "ron", "serde", "tracing", @@ -1123,36 +1101,15 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" -dependencies = [ - "fontdb 0.15.0", - "libm", - "log", - "rangemap", - "rustc-hash", - "rustybuzz 0.11.0", - "self_cell 1.0.2", - "swash", - "sys-locale", - "unicode-bidi", - "unicode-linebreak", - "unicode-script", - "unicode-segmentation", -] - -[[package]] -name = "cosmic-text" -version = "0.10.0" -source = "git+https://github.com/pop-os/cosmic-text.git?branch=refactor#8fc93d90933ded737ea4f7ca63ab064a5331710d" +source = "git+https://github.com/pop-os/cosmic-text.git?branch=refactor#6abf336e6df08771d80232b2d6853269be34ee28" dependencies = [ "bitflags 2.4.1", - "fontdb 0.16.0", + "fontdb", "libm", "log", "rangemap", "rustc-hash", - "rustybuzz 0.12.1", + "rustybuzz", "self_cell 1.0.2", "swash", "sys-locale", @@ -1165,23 +1122,10 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "almost", - "cosmic-config 0.1.0", - "csscolorparser", - "lazy_static", - "palette", - "ron", - "serde", -] - -[[package]] -name = "cosmic-theme" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "almost", - "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-config", "csscolorparser", "lazy_static", "palette", @@ -1195,7 +1139,7 @@ version = "0.4.0" source = "git+https://github.com/pop-os/cosmic-time#4dc1fcec44aa7471a8e707fa391f9882d23250d7" dependencies = [ "float-cmp", - "libcosmic 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "libcosmic", "once_cell", ] @@ -1974,20 +1918,6 @@ dependencies = [ "roxmltree 0.18.1", ] -[[package]] -name = "fontdb" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020e203f177c0fb250fb19455a252e838d2bbbce1f80f25ecc42402aafa8cd38" -dependencies = [ - "fontconfig-parser", - "log", - "memmap2 0.8.0", - "slotmap", - "tinyvec", - "ttf-parser 0.19.2", -] - [[package]] name = "fontdb" version = "0.16.0" @@ -1999,7 +1929,7 @@ dependencies = [ "memmap2 0.9.0", "slotmap", "tinyvec", - "ttf-parser 0.20.0", + "ttf-parser", ] [[package]] @@ -2359,18 +2289,7 @@ name = "glyphon" version = "0.3.0" source = "git+https://github.com/jackpot51/glyphon.git?branch=refactor#c28dc99c86b6b598633e6623096b21632f266976" dependencies = [ - "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", - "etagere", - "lru", - "wgpu", -] - -[[package]] -name = "glyphon" -version = "0.3.0" -source = "git+https://github.com/grovesNL/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85#2caa9fc5e5923c1d827d177c3619cab7e9885b85" -dependencies = [ - "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cosmic-text", "etagere", "lru", "wgpu", @@ -2687,44 +2606,22 @@ dependencies = [ [[package]] name = "iced" version = "0.12.0" -dependencies = [ - "iced_accessibility 0.1.0", - "iced_core 0.12.0", - "iced_futures 0.12.0", - "iced_renderer 0.12.0", - "iced_sctk 0.1.0", - "iced_widget 0.12.0", +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" +dependencies = [ + "iced_accessibility", + "iced_core", + "iced_futures", + "iced_renderer", + "iced_sctk", + "iced_widget", "image", "thiserror", ] -[[package]] -name = "iced" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_sctk 0.1.0 (git+https://github.com/pop-os/libcosmic)", - "iced_widget 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "image", - "thiserror", -] - -[[package]] -name = "iced_accessibility" -version = "0.1.0" -dependencies = [ - "accesskit", - "accesskit_unix", -] - [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "accesskit", "accesskit_unix", @@ -2733,27 +2630,10 @@ dependencies = [ [[package]] name = "iced_core" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "bitflags 1.3.2", - "iced_accessibility 0.1.0", - "instant", - "log", - "num-traits", - "palette", - "raw-window-handle", - "serde", - "smithay-client-toolkit 0.18.0", - "thiserror", - "xxhash-rust", -] - -[[package]] -name = "iced_core" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "bitflags 1.3.2", - "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "iced_accessibility", "instant", "log", "num-traits", @@ -2768,61 +2648,27 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "futures", - "iced_core 0.12.0", + "iced_core", "log", "tokio", "wasm-bindgen-futures", "wasm-timer", ] -[[package]] -name = "iced_futures" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "futures", - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "log", - "tokio", - "wasm-bindgen-futures", - "wasm-timer", -] - -[[package]] -name = "iced_graphics" -version = "0.12.0" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", - "glam", - "half", - "iced_core 0.12.0", - "image", - "kamadak-exif", - "log", - "lyon_path", - "once_cell", - "raw-window-handle", - "rustc-hash", - "thiserror", - "unicode-segmentation", - "xxhash-rust", -] - [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "bitflags 1.3.2", "bytemuck", - "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cosmic-text", "glam", "half", - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_core", "image", "kamadak-exif", "log", @@ -2838,23 +2684,11 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ - "iced_graphics 0.12.0", - "iced_tiny_skia 0.12.0", - "iced_wgpu 0.12.0", - "log", - "raw-window-handle", - "thiserror", -] - -[[package]] -name = "iced_renderer" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_tiny_skia 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_wgpu 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_graphics", + "iced_tiny_skia", + "iced_wgpu", "log", "raw-window-handle", "thiserror", @@ -2863,22 +2697,11 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ - "iced_accessibility 0.1.0", - "iced_core 0.12.0", - "iced_futures 0.12.0", - "smithay-client-toolkit 0.18.0", - "thiserror", -] - -[[package]] -name = "iced_runtime" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "iced_accessibility 0.1.0 (git+https://github.com/pop-os/libcosmic)", - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_accessibility", + "iced_core", + "iced_futures", "smithay-client-toolkit 0.18.0", "thiserror", ] @@ -2886,38 +2709,15 @@ dependencies = [ [[package]] name = "iced_sctk" version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "enum-repr", "float-cmp", "futures", - "iced_futures 0.12.0", - "iced_graphics 0.12.0", - "iced_runtime 0.12.0", - "iced_style 0.12.0", - "itertools 0.10.5", - "lazy_static", - "raw-window-handle", - "smithay-client-toolkit 0.18.0", - "smithay-clipboard", - "thiserror", - "tracing", - "wayland-backend 0.3.2", - "wayland-protocols 0.31.0", - "xkeysym", -] - -[[package]] -name = "iced_sctk" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "enum-repr", - "float-cmp", - "futures", - "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_futures", + "iced_graphics", + "iced_runtime", + "iced_style", "itertools 0.10.5", "lazy_static", "raw-window-handle", @@ -2933,51 +2733,25 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ - "iced_core 0.12.0", + "iced_core", "once_cell", "palette", ] -[[package]] -name = "iced_style" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "once_cell", - "palette", -] - -[[package]] -name = "iced_tiny_skia" -version = "0.12.0" -dependencies = [ - "bytemuck", - "cosmic-text 0.10.0 (git+https://github.com/pop-os/cosmic-text.git?branch=refactor)", - "iced_graphics 0.12.0", - "kurbo", - "log", - "raw-window-handle", - "resvg 0.37.0", - "rustc-hash", - "softbuffer", - "tiny-skia", - "xxhash-rust", -] - [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "bytemuck", - "cosmic-text 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-text", + "iced_graphics", "kurbo", "log", "raw-window-handle", - "resvg 0.36.0", + "resvg", "rustc-hash", "softbuffer", "tiny-skia", @@ -2987,64 +2761,31 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "bitflags 1.3.2", "bytemuck", "futures", "glam", - "glyphon 0.3.0 (git+https://github.com/jackpot51/glyphon.git?branch=refactor)", + "glyphon", "guillotiere", - "iced_graphics 0.12.0", + "iced_graphics", "log", "lyon", "once_cell", "raw-window-handle", - "resvg 0.37.0", + "resvg", "wgpu", ] -[[package]] -name = "iced_wgpu" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "futures", - "glam", - "glyphon 0.3.0 (git+https://github.com/grovesNL/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85)", - "guillotiere", - "iced_graphics 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "log", - "lyon", - "once_cell", - "raw-window-handle", - "resvg 0.36.0", - "wgpu", -] - -[[package]] -name = "iced_widget" -version = "0.12.0" -dependencies = [ - "iced_renderer 0.12.0", - "iced_runtime 0.12.0", - "iced_style 0.12.0", - "num-traits", - "ouroboros", - "smithay-client-toolkit 0.18.0", - "thiserror", - "unicode-segmentation", -] - [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ - "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced_renderer", + "iced_runtime", + "iced_style", "num-traits", "ouroboros", "smithay-client-toolkit 0.18.0", @@ -3308,64 +3049,28 @@ checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libcosmic" version = "0.1.0" +source = "git+https://github.com/pop-os/libcosmic#5cb818a5f98e8060f393ae86c887a3fa214f9e07" dependencies = [ "apply", "ashpd", "cosmic-client-toolkit", - "cosmic-config 0.1.0", - "cosmic-panel-config", - "cosmic-theme 0.1.0", - "css-color", - "derive_setters", - "fraction", - "freedesktop-icons", - "iced 0.12.0", - "iced_core 0.12.0", - "iced_futures 0.12.0", - "iced_renderer 0.12.0", - "iced_runtime 0.12.0", - "iced_sctk 0.1.0", - "iced_style 0.12.0", - "iced_tiny_skia 0.12.0", - "iced_widget 0.12.0", - "lazy_static", - "palette", - "ron", - "slotmap", - "taffy", - "thiserror", - "tokio", - "tracing", - "unicode-segmentation", - "url", - "zbus", -] - -[[package]] -name = "libcosmic" -version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#a9df1667409844bbc333623705830c4da031960a" -dependencies = [ - "apply", - "ashpd", - "cosmic-client-toolkit", - "cosmic-config 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-config", "cosmic-panel-config", "cosmic-settings-daemon", - "cosmic-theme 0.1.0 (git+https://github.com/pop-os/libcosmic)", + "cosmic-theme", "css-color", "derive_setters", "fraction", "freedesktop-icons", - "iced 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_core 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_futures 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_renderer 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_runtime 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_sctk 0.1.0 (git+https://github.com/pop-os/libcosmic)", - "iced_style 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_tiny_skia 0.12.0 (git+https://github.com/pop-os/libcosmic)", - "iced_widget 0.12.0 (git+https://github.com/pop-os/libcosmic)", + "iced", + "iced_core", + "iced_futures", + "iced_renderer", + "iced_runtime", + "iced_sctk", + "iced_style", + "iced_tiny_skia", + "iced_widget", "lazy_static", "nix 0.27.1", "palette", @@ -4549,23 +4254,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" -[[package]] -name = "resvg" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7980f653f9a7db31acff916a262c3b78c562919263edea29bf41a056e20497" -dependencies = [ - "gif", - "jpeg-decoder", - "log", - "pico-args", - "png", - "rgb", - "svgtypes 0.12.0", - "tiny-skia", - "usvg 0.36.0", -] - [[package]] name = "resvg" version = "0.37.0" @@ -4578,9 +4266,9 @@ dependencies = [ "pico-args", "png", "rgb", - "svgtypes 0.13.0", + "svgtypes", "tiny-skia", - "usvg 0.37.0", + "usvg", ] [[package]] @@ -4742,39 +4430,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" -[[package]] -name = "rustybuzz" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71cd15fef9112a1f94ac64b58d1e4628192631ad6af4dc69997f995459c874e7" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "smallvec", - "ttf-parser 0.19.2", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-properties", - "unicode-script", -] - -[[package]] -name = "rustybuzz" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee8fe2a8461a0854a37101fe7a1b13998d0cfa987e43248e81d2a5f4570f6fa" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "libm", - "smallvec", - "ttf-parser 0.20.0", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-properties", - "unicode-script", -] - [[package]] name = "rustybuzz" version = "0.12.1" @@ -4785,7 +4440,7 @@ dependencies = [ "bytemuck", "libm", "smallvec", - "ttf-parser 0.20.0", + "ttf-parser", "unicode-bidi-mirroring", "unicode-ccc", "unicode-properties", @@ -5159,16 +4814,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" -[[package]] -name = "svgtypes" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71499ff2d42f59d26edb21369a308ede691421f79ebc0f001e2b1fd3a7c9e52" -dependencies = [ - "kurbo", - "siphasher", -] - [[package]] name = "svgtypes" version = "0.13.0" @@ -5585,12 +5230,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "ttf-parser" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" - [[package]] name = "ttf-parser" version = "0.20.0" @@ -5728,21 +5367,6 @@ dependencies = [ "serde", ] -[[package]] -name = "usvg" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51daa774fe9ee5efcf7b4fec13019b8119cda764d9a8b5b06df02bb1445c656" -dependencies = [ - "base64", - "log", - "pico-args", - "usvg-parser 0.36.0", - "usvg-text-layout 0.36.0", - "usvg-tree 0.36.0", - "xmlwriter", -] - [[package]] name = "usvg" version = "0.37.0" @@ -5752,30 +5376,12 @@ dependencies = [ "base64", "log", "pico-args", - "usvg-parser 0.37.0", - "usvg-text-layout 0.37.0", - "usvg-tree 0.37.0", + "usvg-parser", + "usvg-text-layout", + "usvg-tree", "xmlwriter", ] -[[package]] -name = "usvg-parser" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c88a5ffaa338f0e978ecf3d4e00d8f9f493e29bed0752e1a808a1db16afc40" -dependencies = [ - "data-url", - "flate2", - "imagesize", - "kurbo", - "log", - "roxmltree 0.18.1", - "simplecss", - "siphasher", - "svgtypes 0.12.0", - "usvg-tree 0.36.0", -] - [[package]] name = "usvg-parser" version = "0.37.0" @@ -5790,24 +5396,8 @@ dependencies = [ "roxmltree 0.19.0", "simplecss", "siphasher", - "svgtypes 0.13.0", - "usvg-tree 0.37.0", -] - -[[package]] -name = "usvg-text-layout" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2374378cb7a3fb8f33894e0fdb8625e1bbc4f25312db8d91f862130b541593" -dependencies = [ - "fontdb 0.15.0", - "kurbo", - "log", - "rustybuzz 0.10.0", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "usvg-tree 0.36.0", + "svgtypes", + "usvg-tree", ] [[package]] @@ -5816,26 +5406,14 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d383a3965de199d7f96d4e11a44dd859f46e86de7f3dca9a39bf82605da0a37c" dependencies = [ - "fontdb 0.16.0", + "fontdb", "kurbo", "log", - "rustybuzz 0.12.1", + "rustybuzz", "unicode-bidi", "unicode-script", "unicode-vo", - "usvg-tree 0.37.0", -] - -[[package]] -name = "usvg-tree" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cacb0c5edeaf3e80e5afcf5b0d4004cc1d36318befc9a7c6606507e5d0f4062" -dependencies = [ - "rctree", - "strict-num", - "svgtypes 0.12.0", - "tiny-skia-path", + "usvg-tree", ] [[package]] @@ -5846,7 +5424,7 @@ checksum = "8ee3d202ebdb97a6215604b8f5b4d6ef9024efd623cf2e373a6416ba976ec7d3" dependencies = [ "rctree", "strict-num", - "svgtypes 0.13.0", + "svgtypes", "tiny-skia-path", ] diff --git a/cosmic-app-list/Cargo.toml b/cosmic-app-list/Cargo.toml index 2417bc27..9dc3d0bd 100644 --- a/cosmic-app-list/Cargo.toml +++ b/cosmic-app-list/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] cctk.workspace = true cosmic-protocols.workspace = true -# libcosmic.workspace = true -libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio", "applet"] } +libcosmic.workspace = true +# libcosmic = { path = "../../libcosmic", default-features = false, features = ["wayland", "tokio", "applet"] } ron = "0.8" futures = "0.3" futures-util = "0.3" diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index 6133e5b8..79a31dd2 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -264,7 +264,12 @@ impl IconSource { fn as_cosmic_icon(&self) -> cosmic::widget::icon::Icon { match self { - Self::Name(name) => cosmic::widget::icon::from_name(name.as_str()).into(), + Self::Name(name) => cosmic::widget::icon::from_name(name.as_str()) + .fallback(Some(cosmic::widget::icon::IconFallback::Names(vec![ + "application-default".into(), + "application-x-executable".into(), + ]))) + .into(), Self::Path(path) => cosmic::widget::icon(cosmic::widget::icon::from_path(path.clone())), } } From edc811333b27a1868b02bce3976bee49b12d7ec6 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 5 Jan 2024 10:42:22 -0500 Subject: [PATCH 4/4] fix: add size to named icon --- cosmic-app-list/src/app.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index 79a31dd2..bc1bc58c 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -265,6 +265,7 @@ impl IconSource { fn as_cosmic_icon(&self) -> cosmic::widget::icon::Icon { match self { Self::Name(name) => cosmic::widget::icon::from_name(name.as_str()) + .size(128) .fallback(Some(cosmic::widget::icon::IconFallback::Names(vec![ "application-default".into(), "application-x-executable".into(),