Skip to content

Commit

Permalink
Merge pull request #135 from JakeStanger/oknozor/master
Browse files Browse the repository at this point in the history
fix: fallback to default icon theme for notifier items
  • Loading branch information
JakeStanger committed May 1, 2023
2 parents 51e95d9 + 98aaaa0 commit bde4698
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/modules/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ pub struct TrayModule {
/// Attempts to get a GTK `Image` component
/// for the status notifier item's icon.
fn get_image_from_icon_name(item: &StatusNotifierItem) -> Option<Image> {
item.icon_theme_path.as_ref().and_then(|path| {
let theme = IconTheme::new();
theme.append_search_path(path);

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()))
let theme = item
.icon_theme_path
.as_ref()
.map(|path| {
let theme = IconTheme::new();
theme.append_search_path(path);
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()))
})
}

Expand Down

0 comments on commit bde4698

Please sign in to comment.