staus-area: Initial support to use IconThemePath for icon loading

We should use a more complicated method to lookup the icon from the
theme, but `cosmic-freedesktop-icons` will need some changes to be able
to accomodate a custom theme path.

This is probably an improvement. Anything that uses `IconThemePath`
is likely not working currently, so it won't make things worse.
This commit is contained in:
Ian Douglas Scott 2025-11-04 12:55:59 -08:00 committed by Jacob Kauffmann
parent 080f07e0b4
commit d04314957b
2 changed files with 17 additions and 4 deletions

View file

@ -524,11 +524,16 @@ fn menu_icon_button<'a>(
applet: &'a cosmic::applet::Context,
menu: &'a status_menu::State,
) -> cosmic::widget::Button<'a, Msg> {
match menu.icon_pixmap() {
Some(icon) if menu.icon_name() == "" => {
applet.icon_button_from_handle(icon.clone().symbolic(true))
match (menu.icon_pixmap(), menu.icon_name(), menu.icon_theme_path()) {
(Some(icon), "", _) => applet.icon_button_from_handle(icon.clone().symbolic(true)),
(_, name, Some(theme_path)) if name != "" => {
let mut path = theme_path.to_owned();
// XXX right way to lookup icon in dir?
path.push(name.to_owned() + ".png");
let icon = cosmic::widget::icon::from_path(path).symbolic(true);
applet.icon_button_from_handle(icon)
}
_ => applet.icon_button(menu.icon_name()),
(_, name, _) => applet.icon_button(name),
}
}