panel: Desaturate appmenu icon

Top bar icons are supposed to by symbolic, but not all applications
provide a symbolic icon. Make the stick out less by desaturating
the appmenu icon if a symbolic style is requested.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
This commit is contained in:
Florian Müllner 2019-02-05 00:30:41 +01:00
parent 8003f8b803
commit 1c117c469a

View File

@ -222,9 +222,16 @@ var AppMenuButton = GObject.registerClass({
textureCache.connect('icon-theme-changed', textureCache.connect('icon-theme-changed',
this._onIconThemeChanged.bind(this)); this._onIconThemeChanged.bind(this));
let iconEffect = new Clutter.DesaturateEffect();
this._iconBox = new St.Bin({ style_class: 'app-menu-icon' }); this._iconBox = new St.Bin({ style_class: 'app-menu-icon' });
this._iconBox.add_effect(iconEffect);
this._container.add_actor(this._iconBox); this._container.add_actor(this._iconBox);
this._iconBox.connect('style-changed', () => {
let themeNode = this._iconBox.get_theme_node();
iconEffect.enabled = themeNode.get_icon_style() == St.IconStyle.SYMBOLIC;
});
this._label = new St.Label({ y_expand: true, this._label = new St.Label({ y_expand: true,
y_align: Clutter.ActorAlign.CENTER }); y_align: Clutter.ActorAlign.CENTER });
this._container.add_actor(this._label); this._container.add_actor(this._label);