Skip to content

Commit 380d329

Browse files
committed
launcher: crisp category/app icons; size-aware lookup; prefer SVG only for symbolic
1 parent aea652a commit 380d329

1 file changed

Lines changed: 29 additions & 21 deletions

File tree

src/app.rs

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -768,35 +768,43 @@ impl cosmic::Application for CosmicLauncher {
768768
IconSource::Name(name) | IconSource::Mime(name) => name,
769769
};
770770
button_content.push(
771-
icon(from_name(name.clone()).into())
772-
.width(Length::Fixed(16.0))
773-
.height(Length::Fixed(16.0))
774-
.class(cosmic::theme::Svg::Custom(Rc::new(|theme| {
775-
cosmic::iced::widget::svg::Style {
776-
color: Some(theme.cosmic().on_bg_color().into()),
777-
}
778-
})))
779-
.into(),
771+
icon(
772+
from_name(name.clone())
773+
.prefer_svg(true)
774+
.symbolic(true)
775+
.size(16)
776+
.into(),
777+
)
778+
.width(Length::Fixed(16.0))
779+
.height(Length::Fixed(16.0))
780+
.class(cosmic::theme::Svg::Custom(Rc::new(|theme| {
781+
cosmic::iced::widget::svg::Style {
782+
color: Some(theme.cosmic().on_bg_color().into()),
783+
}
784+
})))
785+
.into(),
780786
);
781787
}
782788
}
783789
if let Some(source) = item.icon.as_ref() {
784790
let name = match source {
785791
IconSource::Name(name) | IconSource::Mime(name) => name,
786792
};
793+
// Only prefer SVG for symbolic icons; otherwise pick size-aware raster via theme.
794+
let mut named = from_name(name.clone())
795+
.size(64)
796+
.fallback(Some(IconFallback::Names(vec![
797+
"application-default".into(),
798+
"application-x-executable".into(),
799+
])));
800+
if name.ends_with("-symbolic") {
801+
named = named.prefer_svg(true);
802+
}
787803
button_content.push(
788-
icon(
789-
from_name(name.clone())
790-
.size(64)
791-
.fallback(Some(IconFallback::Names(vec![
792-
"application-default".into(),
793-
"application-x-executable".into(),
794-
])))
795-
.into(),
796-
)
797-
.width(Length::Fixed(32.0))
798-
.height(Length::Fixed(32.0))
799-
.into(),
804+
icon(named.into())
805+
.width(Length::Fixed(32.0))
806+
.height(Length::Fixed(32.0))
807+
.into(),
800808
);
801809
}
802810

0 commit comments

Comments
 (0)