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:
@@ -380,12 +380,28 @@ namespace SwayNotificationCenter.Widgets.Mpris {
|
|||||||
if (desktop_entry is DesktopAppInfo) {
|
if (desktop_entry is DesktopAppInfo) {
|
||||||
icon = desktop_entry.get_icon ();
|
icon = desktop_entry.get_icon ();
|
||||||
}
|
}
|
||||||
|
Gtk.IconInfo ? icon_info = null;
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
album_art.set_from_gicon (icon, Gtk.IconSize.INVALID);
|
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 {
|
} else {
|
||||||
// Default icon
|
// 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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user