From bd5162105e1365e12d69c408fad8d6c231af96c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 16 Jul 2019 00:37:13 +0200 Subject: [PATCH] power: Make sure we fall back to the correct icon Commit bd18313d12 changed to a new naming scheme for battery icons, and used to old icon names as fallback-icon-name for compatibility with older/other icon themes. However that fallback code isn't working correctly, as GThemedIcon's default fallbacks will transform a name of `battery-level-90-symbolic` to a list of names: - `battery-level-90-symbolic` - `battery-level-symbolic` - `battery-symbolic` The last one frequently exists, so instead of the intended fallback, we end up with a generic battery icon. Address this by specifying the icon as GIcon instead of an icon-name, where we have more control over how the icon is resolved. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1442 --- js/ui/status/power.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/ui/status/power.js b/js/ui/status/power.js index 8ffb0c631..54475d029 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -114,8 +114,15 @@ var Indicator = class extends PanelMenu.SystemIndicator { ? 'battery-level-100-charged-symbolic' : `battery-level-${fillLevel}${chargingState}-symbolic`; - this._indicator.icon_name = icon; - this._item.icon.icon_name = icon; + // Make sure we fall back to fallback-icon-name and not GThemedIcon's + // default fallbacks + let gicon = new Gio.ThemedIcon({ + name: icon, + use_default_fallbacks: false + }); + + this._indicator.gicon = gicon; + this._item.icon.gicon = gicon; let fallbackIcon = this._proxy.IconName; this._indicator.fallback_icon_name = fallbackIcon;