fix(ui): fall back to Adwaita when system icon theme is broken
If the configured icon theme (e.g. Sweet-Blue) doesn't exist on disk,
GTK falls back to hicolor which has almost no icons. Detect this by
probing for a standard icon, and set Adwaita as the theme — it's
guaranteed to exist as a GTK4 dependency.
This replaces the broken add_search_path("/usr/share/icons/Adwaita")
approach which doesn't work because search paths are scoped to the
active theme name, not the directory name.
This commit is contained in:
@@ -185,16 +185,19 @@ impl OwlryApp {
|
||||
}
|
||||
|
||||
fn setup_icon_theme() {
|
||||
// Ensure we have icon fallbacks for weather/media icons
|
||||
// These may not exist in all icon themes
|
||||
if let Some(display) = gtk4::gdk::Display::default() {
|
||||
let icon_theme = gtk4::IconTheme::for_display(&display);
|
||||
|
||||
// Add Adwaita as fallback search path (has weather and media icons)
|
||||
icon_theme.add_search_path("/usr/share/icons/Adwaita");
|
||||
icon_theme.add_search_path("/usr/share/icons/breeze");
|
||||
|
||||
debug!("Icon theme search paths configured with Adwaita/breeze fallbacks");
|
||||
// If the system icon theme can't resolve standard icons (e.g., the
|
||||
// configured theme doesn't exist on disk), fall back to Adwaita
|
||||
// which is guaranteed to be installed as a GTK4 dependency.
|
||||
if !icon_theme.has_icon("edit-find-symbolic") {
|
||||
debug!(
|
||||
"System icon theme '{}' cannot resolve standard icons, falling back to Adwaita",
|
||||
icon_theme.theme_name()
|
||||
);
|
||||
icon_theme.set_theme_name(Some("Adwaita"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user