mirror of
https://github.com/ErikReider/SwayNotificationCenter.git
synced 2024-10-05 21:08:40 +03:00
Add MPRIS background blur for app icons (#369)
* Fix default mpris icon size The widget was was using the .ui size instead of the user config size in the following situations: - there was no media player app - the media player app icon was used - the audio-x-generic-symbolic icon was used This fix sets the default size for the album art icon according to the user's config. set_from_gicon and set_from_icon_name receive a Gtk.IconSize enum value, not an int, so we need to call set_pixel_size to set the proper size. * Add MPRIS background blur for app icons --------- Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
This commit is contained in:
parent
8cb9be5970
commit
af8ac2f7d7
@ -380,12 +380,28 @@ namespace SwayNotificationCenter.Widgets.Mpris {
|
||||
if (desktop_entry is DesktopAppInfo) {
|
||||
icon = desktop_entry.get_icon ();
|
||||
}
|
||||
Gtk.IconInfo ? icon_info = null;
|
||||
if (icon != null) {
|
||||
album_art.set_from_gicon (icon, Gtk.IconSize.INVALID);
|
||||
icon_info = Gtk.IconTheme.get_default ().lookup_by_gicon (icon,
|
||||
mpris_config.image_size,
|
||||
Gtk.IconLookupFlags.USE_BUILTIN);
|
||||
} else {
|
||||
// Default icon
|
||||
album_art.set_from_icon_name ("audio-x-generic-symbolic",
|
||||
string icon_name = "audio-x-generic-symbolic";
|
||||
album_art.set_from_icon_name (icon_name,
|
||||
Gtk.IconSize.INVALID);
|
||||
icon_info = Gtk.IconTheme.get_default ().lookup_icon (icon_name,
|
||||
mpris_config.image_size,
|
||||
Gtk.IconLookupFlags.USE_BUILTIN);
|
||||
}
|
||||
|
||||
if (icon_info != null) {
|
||||
try {
|
||||
this.album_art_pixbuf = icon_info.load_icon ();
|
||||
} catch (Error e) {
|
||||
warning ("Could not load icon: %s", e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user