fix: use libcosmic icon with fallbacks

This commit is contained in:
Ashley Wulber 2024-01-03 13:47:52 -05:00 • committed by Ashley Wulber
parent aab284f6f1
commit fdfa667f38
3 changed files with 101 additions and 518 deletions

View file

@ -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"

View file

@ -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())),
}
}