fix!(desktop): IconSourceExt::as_cosmic_icon should return Handle with SVG preference

This commit is contained in:
Michael Aaron Murphy 2026-01-06 02:25:46 +01:00
parent e9bb5ed97d
commit 421552dea1
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -7,23 +7,22 @@ use std::path::{Path, PathBuf};
use std::{borrow::Cow, collections::HashSet, ffi::OsStr}; use std::{borrow::Cow, collections::HashSet, ffi::OsStr};
pub trait IconSourceExt { pub trait IconSourceExt {
fn as_cosmic_icon(&self) -> crate::widget::icon::Icon; fn as_cosmic_icon(&self) -> crate::widget::icon::Handle;
} }
#[cfg(not(windows))] #[cfg(not(windows))]
impl IconSourceExt for fde::IconSource { impl IconSourceExt for fde::IconSource {
fn as_cosmic_icon(&self) -> crate::widget::icon::Icon { fn as_cosmic_icon(&self) -> crate::widget::icon::Handle {
match self { match self {
fde::IconSource::Name(name) => crate::widget::icon::from_name(name.as_str()) fde::IconSource::Name(name) => crate::widget::icon::from_name(name.as_str())
.prefer_svg(true)
.size(128) .size(128)
.fallback(Some(crate::widget::icon::IconFallback::Names(vec![ .fallback(Some(crate::widget::icon::IconFallback::Names(vec![
"application-default".into(), "application-default".into(),
"application-x-executable".into(), "application-x-executable".into(),
]))) ])))
.into(), .handle(),
fde::IconSource::Path(path) => { fde::IconSource::Path(path) => crate::widget::icon::from_path(path.clone()),
crate::widget::icon(crate::widget::icon::from_path(path.clone()))
}
} }
} }
} }