From cfab668d6cb42e6883ac9155cdaebd94484a9443 Mon Sep 17 00:00:00 2001 From: hlechner Date: Sun, 26 Jul 2020 18:57:11 -0300 Subject: [PATCH 1/2] add option to change Show Desktop line color --- Settings.ui | 55 +++++++++++++++++++ panel.js | 23 ++++++-- prefs.js | 18 ++++++ ...shell.extensions.dash-to-panel.gschema.xml | 10 ++++ 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/Settings.ui b/Settings.ui index 052397f..b6c59fe 100644 --- a/Settings.ui +++ b/Settings.ui @@ -3972,6 +3972,7 @@ 12 12 12 + 4 32 @@ -4001,6 +4002,60 @@ 0 + + + True + False + True + Override Show Desktop line color + 0 + + + 0 + 1 + + + + + True + False + 12 + end + + + True + True + True + end + True + True + + + False + True + 0 + + + + + True + True + end + center + + + False + True + 1 + + + + + 1 + 0 + 1 + + diff --git a/panel.js b/panel.js index c55a148..e361c27 100644 --- a/panel.js +++ b/panel.js @@ -664,7 +664,17 @@ var dtpPanel = Utils.defineClass({ [ Me.settings, 'changed::showdesktop-button-width', - () => this._setShowDesktopButtonSize() + () => this._setShowDesktopButtonStyle() + ], + [ + Me.settings, + 'changed::desktop-line-use-custom-color', + () => this._setShowDesktopButtonStyle() + ], + [ + Me.settings, + 'changed::desktop-line-custom-color', + () => this._setShowDesktopButtonStyle() ], [ Me.desktopSettings, @@ -1253,7 +1263,7 @@ var dtpPanel = Utils.defineClass({ y_fill: true, track_hover: true }); - this._setShowDesktopButtonSize(); + this._setShowDesktopButtonStyle(); this._showDesktopButton.connect('button-press-event', () => this._onShowDesktopButtonPress()); this._showDesktopButton.connect('enter-event', () => { @@ -1290,11 +1300,16 @@ var dtpPanel = Utils.defineClass({ } }, - _setShowDesktopButtonSize: function() { + _setShowDesktopButtonStyle: function() { if (this._showDesktopButton) { let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;'; let isVertical = this.checkIfVertical(); - let sytle = isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize; + + let lineRgbaColor = Me.settings.get_string('desktop-line-custom-color'); + let isLineCustom = Me.settings.get_boolean('desktop-line-use-custom-color'); + + let sytle = isLineCustom ? 'border:0 solid ' + lineRgbaColor + ';' : ''; + sytle += isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize; this._showDesktopButton.set_style(sytle); this._showDesktopButton[(isVertical ? 'x' : 'y') + '_expand'] = true; diff --git a/prefs.js b/prefs.js index 4eeb162..08fe22c 100644 --- a/prefs.js +++ b/prefs.js @@ -920,6 +920,24 @@ const Settings = new Lang.Class({ dialog.show_all(); })); + + this._settings.bind('desktop-line-use-custom-color', + this._builder.get_object('override_show_desktop_line_color_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + + this._settings.bind('desktop-line-use-custom-color', + this._builder.get_object('override_show_desktop_line_color_colorbutton'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT); + + rgba.parse(this._settings.get_string('desktop-line-custom-color')); + this._builder.get_object('override_show_desktop_line_color_colorbutton').set_rgba(rgba); + this._builder.get_object('override_show_desktop_line_color_colorbutton').connect('notify::color', Lang.bind(this, function (button) { + let rgba = button.get_rgba(); + let css = rgba.to_string(); + this._settings.set_string('desktop-line-custom-color', css); + })); this._settings.bind('intellihide', 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 5fb3501..a18665c 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -92,6 +92,16 @@ Panel size Set the size of the panel. + + false + Override Show Desktop line color + Replace current Show Desktop button line color + + + "rgba(200,200,200,0.2)" + Custom Show Desktop line color + Custom Show Desktop button line color + 'BOTTOM' Dot position From 05ae40e97b2dc0ade7bbf1b4554cfd8bed837bfd Mon Sep 17 00:00:00 2001 From: hlechner Date: Sun, 2 Aug 2020 14:00:05 -0300 Subject: [PATCH 2/2] resolving merge conflicts --- panel.js | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/panel.js b/panel.js index e361c27..5ab395d 100644 --- a/panel.js +++ b/panel.js @@ -326,7 +326,7 @@ var dtpPanel = Utils.defineClass({ [ Utils.getStageTheme(), 'changed', - () => this._resetGeometry() + () => (this._resetGeometry(), this._setShowDesktopButtonStyle()), ], [ // sync hover after a popupmenu is closed @@ -663,17 +663,13 @@ var dtpPanel = Utils.defineClass({ ], [ Me.settings, - 'changed::showdesktop-button-width', - () => this._setShowDesktopButtonStyle() - ], - [ - Me.settings, - 'changed::desktop-line-use-custom-color', - () => this._setShowDesktopButtonStyle() - ], - [ - Me.settings, - 'changed::desktop-line-custom-color', + [ + 'changed::showdesktop-button-width', + 'changed::trans-use-custom-bg', + 'changed::desktop-line-use-custom-color', + 'changed::desktop-line-custom-color', + 'changed::trans-bg-color' + ], () => this._setShowDesktopButtonStyle() ], [ @@ -1267,7 +1263,8 @@ var dtpPanel = Utils.defineClass({ this._showDesktopButton.connect('button-press-event', () => this._onShowDesktopButtonPress()); this._showDesktopButton.connect('enter-event', () => { - this._showDesktopButton.add_style_class_name('showdesktop-button-hovered'); + this._showDesktopButton.add_style_class_name(this._getBackgroundBrightness() ? + 'showdesktop-button-light-hovered' : 'showdesktop-button-dark-hovered'); if (Me.settings.get_boolean('show-showdesktop-hover')) { this._timeoutsHandler.add([T4, Me.settings.get_int('show-showdesktop-delay'), () => { @@ -1278,7 +1275,8 @@ var dtpPanel = Utils.defineClass({ }); this._showDesktopButton.connect('leave-event', () => { - this._showDesktopButton.remove_style_class_name('showdesktop-button-hovered'); + this._showDesktopButton.remove_style_class_name(this._getBackgroundBrightness() ? + 'showdesktop-button-light-hovered' : 'showdesktop-button-dark-hovered'); if (Me.settings.get_boolean('show-showdesktop-hover')) { if (this._timeoutsHandler.getId(T4)) { @@ -1301,21 +1299,28 @@ var dtpPanel = Utils.defineClass({ }, _setShowDesktopButtonStyle: function() { + let rgb = this._getBackgroundBrightness() ? "rgba(55, 55, 55, .2)" : "rgba(200, 200, 200, .2)"; + + let isLineCustom = Me.settings.get_boolean('desktop-line-use-custom-color'); + rgb = isLineCustom ? Me.settings.get_string('desktop-line-custom-color') : rgb; + if (this._showDesktopButton) { let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;'; let isVertical = this.checkIfVertical(); - - let lineRgbaColor = Me.settings.get_string('desktop-line-custom-color'); - let isLineCustom = Me.settings.get_boolean('desktop-line-use-custom-color'); - - let sytle = isLineCustom ? 'border:0 solid ' + lineRgbaColor + ';' : ''; + + let sytle = "border: 0 solid " + rgb + ";"; sytle += isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize; - + this._showDesktopButton.set_style(sytle); this._showDesktopButton[(isVertical ? 'x' : 'y') + '_expand'] = true; } }, + // _getBackgroundBrightness: return true if panel has a bright background color + _getBackgroundBrightness: function() { + return Utils.checkIfColorIsBright(this.dynamicTransparency.backgroundColorRgb); + }, + _toggleWorkspaceWindows: function(hide, workspace) { let tweenOpts = { opacity: hide ? 0 : 255,