mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +02:00
fix: fallback to default icon theme for notifier items
This commit is contained in:
parent
51e95d9e01
commit
98aaaa0d14
1 changed files with 12 additions and 7 deletions
|
@ -27,14 +27,19 @@ pub struct TrayModule {
|
||||||
/// Attempts to get a GTK `Image` component
|
/// Attempts to get a GTK `Image` component
|
||||||
/// for the status notifier item's icon.
|
/// for the status notifier item's icon.
|
||||||
fn get_image_from_icon_name(item: &StatusNotifierItem) -> Option<Image> {
|
fn get_image_from_icon_name(item: &StatusNotifierItem) -> Option<Image> {
|
||||||
item.icon_theme_path.as_ref().and_then(|path| {
|
let theme = item
|
||||||
let theme = IconTheme::new();
|
.icon_theme_path
|
||||||
theme.append_search_path(path);
|
.as_ref()
|
||||||
|
.map(|path| {
|
||||||
item.icon_name.as_ref().and_then(|icon_name| {
|
let theme = IconTheme::new();
|
||||||
let icon_info = theme.lookup_icon(icon_name, 16, IconLookupFlags::empty());
|
theme.append_search_path(path);
|
||||||
icon_info.map(|icon_info| Image::from_pixbuf(icon_info.load_icon().ok().as_ref()))
|
theme
|
||||||
})
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
item.icon_name.as_ref().and_then(|icon_name| {
|
||||||
|
let icon_info = theme.lookup_icon(icon_name, 16, IconLookupFlags::empty());
|
||||||
|
icon_info.map(|icon_info| Image::from_pixbuf(icon_info.load_icon().ok().as_ref()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue