From 70da5672e243e773ef2fe0f480ea08df8408dbae Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Thu, 21 Sep 2023 19:22:26 -0700 Subject: [PATCH] fix: use `St.IconTheme` in the shell process --- utils.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/utils.js b/utils.js index 0bb9474..9fd74af 100644 --- a/utils.js +++ b/utils.js @@ -26,7 +26,6 @@ import GdkPixbuf from 'gi://GdkPixbuf'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import Graphene from 'gi://Graphene'; -import Gtk from 'gi://Gtk'; import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -696,14 +695,9 @@ export const DominantColorExtractor = class { */ _getIconPixBuf() { let iconTexture = this._app.create_icon_texture(16); - let isGtk3 = !!Gtk.IconTheme.prototype.set_custom_theme; if (themeLoader === null) { - let ifaceSettings = new Gio.Settings({ schema: "org.gnome.desktop.interface" }); - let themeFunc = isGtk3 ? 'set_custom_theme' : 'set_theme_name'; - - themeLoader = new Gtk.IconTheme(), - themeLoader[themeFunc](ifaceSettings.get_string('icon-theme')); // Make sure the correct theme is loaded + themeLoader = new St.IconTheme(); } // Unable to load the icon texture, use fallback @@ -725,19 +719,11 @@ export const DominantColorExtractor = class { // Get the pixel buffer from the icon theme if (iconTexture instanceof Gio.ThemedIcon) { - let params = [iconTexture.get_names()[0], DOMINANT_COLOR_ICON_SIZE, 0]; - - if (!isGtk3) { - params.splice(1, 0, null); - params.splice(3, 1, 1, 1, 1); - } - - let icon_info = themeLoader.lookup_icon.apply(themeLoader, params); + let icon_info = themeLoader.lookup_icon(iconTexture.get_names()[0], + DOMINANT_COLOR_ICON_SIZE, 0); if (icon_info !== null) { - if (isGtk3) return icon_info.load_icon(); - - return GdkPixbuf.Pixbuf.new_from_file(icon_info.get_file().get_path()); + return icon_info.load_icon(); } }