diff --git a/Settings.ui b/Settings.ui index 1882e6f..b2bdcb7 100644 --- a/Settings.ui +++ b/Settings.ui @@ -839,13 +839,13 @@ True False 12 - 4 + 8 - + True False True - Highlight color + Icon dominant color 0 @@ -853,6 +853,31 @@ 0 + + + True + True + end + center + + + 1 + 0 + + + + + True + False + True + Custom color + 0 + + + 0 + 1 + + True @@ -862,7 +887,7 @@ 1 - 0 + 1 @@ -875,7 +900,7 @@ 0 - 1 + 2 @@ -889,7 +914,7 @@ 1 - 1 + 2 diff --git a/appIcons.js b/appIcons.js index 1dca136..3e8a216 100644 --- a/appIcons.js +++ b/appIcons.js @@ -214,6 +214,7 @@ var taskbarAppIcon = Utils.defineClass({ this._dtpSettings.connect('changed::dot-color-unfocused-3', Lang.bind(this, this._settingsChangeRefresh)), this._dtpSettings.connect('changed::dot-color-unfocused-4', Lang.bind(this, this._settingsChangeRefresh)), this._dtpSettings.connect('changed::focus-highlight', Lang.bind(this, this._settingsChangeRefresh)), + this._dtpSettings.connect('changed::focus-highlight-dominant', Lang.bind(this, this._settingsChangeRefresh)), this._dtpSettings.connect('changed::focus-highlight-color', Lang.bind(this, this._settingsChangeRefresh)), this._dtpSettings.connect('changed::focus-highlight-opacity', Lang.bind(this, this._settingsChangeRefresh)), this._dtpSettings.connect('changed::group-apps-label-font-size', Lang.bind(this, this._updateWindowTitleStyle)), @@ -510,8 +511,8 @@ var taskbarAppIcon = Utils.defineClass({ } } - inlineStyle += "background-color: " + cssHexTocssRgba(this._dtpSettings.get_string('focus-highlight-color'), - this._dtpSettings.get_int('focus-highlight-opacity') * 0.01); + let highlightColor = this._getFocusHighlightColor(); + inlineStyle += "background-color: " + cssHexTocssRgba(highlightColor, this._dtpSettings.get_int('focus-highlight-opacity') * 0.01); } if(this._dotsContainer.get_style() != inlineStyle) { @@ -957,6 +958,15 @@ var taskbarAppIcon = Utils.defineClass({ return color; }, + _getFocusHighlightColor: function() { + if (this._dtpSettings.get_boolean('focus-highlight-dominant')) { + let dce = new Utils.DominantColorExtractor(this.app); + let palette = dce._getColorPalette(); + if (palette) return palette.original; + } + return this._dtpSettings.get_string('focus-highlight-color'); + }, + _drawRunningIndicator: function(area, type, isFocused) { let n = this._getRunningIndicatorCount(); diff --git a/prefs.js b/prefs.js index fc878b1..3260aae 100644 --- a/prefs.js +++ b/prefs.js @@ -377,6 +377,22 @@ const Settings = new Lang.Class({ 'sensitive', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('focus-highlight-dominant', + this._builder.get_object('focus_highlight_dominant_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + + this._settings.bind('focus-highlight-dominant', + this._builder.get_object('focus_highlight_color_label'), + 'sensitive', + Gio.SettingsBindFlags.INVERT_BOOLEAN); + + this._settings.bind('focus-highlight-dominant', + this._builder.get_object('focus_highlight_color_colorbutton'), + 'sensitive', + Gio.SettingsBindFlags.INVERT_BOOLEAN); + + (function() { let rgba = new Gdk.RGBA(); rgba.parse(this._settings.get_string('focus-highlight-color')); @@ -424,6 +440,7 @@ const Settings = new Lang.Class({ this._builder.get_object('dot_size_spinbutton').set_value(this._settings.get_int('dot-size')); this._settings.set_value('focus-highlight', this._settings.get_default_value('focus-highlight')); + this._settings.set_value('focus-highlight-dominant', this._settings.get_default_value('focus-highlight-dominant')); } else { // remove the settings box so it doesn't get destroyed; diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 2a9d862..ddeaf68 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -155,6 +155,11 @@ Highlight icon of focused application Whether to highlight the background of the currently focused application's icon + + false + Highlight icon dominant color + Base the active window highlight color on that application's icon + "#EEEEEE" Color of highlight of focused application