diff --git a/Settings.ui b/Settings.ui index dce178d..3c21cb2 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2175,6 +2175,11 @@ 10 50 + + 100 + 5 + 10 + 50 1 @@ -2599,6 +2604,96 @@ + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + False + True + Use custom opacity for the previews background + True + 0 + + + 0 + 0 + + + + + True + False + True + If disabled, the previews background have the same opacity as the panel + True + 40 + 0 + + + + 0 + 1 + 2 + + + + + True + False + 8 + + + True + True + end + center + + + False + True + 1 + + + + + True + True + end + center + 5 + preview_opacity_adjustment + 5 + + + False + True + 2 + + + + + 1 + 0 + + + + + + True diff --git a/prefs.js b/prefs.js index 7b7aab1..b7db252 100644 --- a/prefs.js +++ b/prefs.js @@ -1042,6 +1042,20 @@ const Settings = new Lang.Class({ this._builder.get_object('preview_aspect_ratio_y_fixed_togglebutton'), 'active', Gio.SettingsBindFlags.DEFAULT); + + this._settings.bind('preview-use-custom-opacity', + this._builder.get_object('preview_custom_opacity_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('preview-use-custom-opacity', + this._builder.get_object('preview_custom_opacity_spinbutton'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT); + + this._builder.get_object('preview_custom_opacity_spinbutton').set_value(this._settings.get_int('preview-custom-opacity')); + this._builder.get_object('preview_custom_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('preview-custom-opacity', widget.get_value()); + })); this._settings.bind('peek-mode', this._builder.get_object('peek_mode_switch'), @@ -1141,6 +1155,11 @@ const Settings = new Lang.Class({ this._settings.set_value('window-preview-animation-time', this._settings.get_default_value('window-preview-animation-time')); this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time')); + this._settings.set_value('preview-use-custom-opacity', this._settings.get_default_value('preview-use-custom-opacity')); + + this._settings.set_value('preview-custom-opacity', this._settings.get_default_value('preview-custom-opacity')); + this._builder.get_object('preview_custom_opacity_spinbutton').set_value(this._settings.get_int('preview-custom-opacity')); + this._settings.set_value('peek-mode', this._settings.get_default_value('peek-mode')); this._settings.set_value('window-preview-show-title', this._settings.get_default_value('window-preview-show-title')); this._settings.set_value('enter-peek-mode-timeout', this._settings.get_default_value('enter-peek-mode-timeout')); 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 744a500..1fa144f 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -589,6 +589,16 @@ Middle click preview to close window Middle click on the window preview to close that window + + true + Window previews use custom opacity + Window previews background use a different opacity from the panel + + + 60 + Window previews background opacity + Window previews use this custom background opacity. + 0 Tray font size diff --git a/windowPreview.js b/windowPreview.js index df308b5..e0b4dd5 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -41,12 +41,12 @@ const T3 = 'peekTimeout'; const MAX_TRANSLATION = 40; const HEADER_HEIGHT = 38; const MIN_DIMENSION = 100; -const MIN_MENU_ALPHA = .6; const FOCUSED_COLOR_OFFSET = 24; const HEADER_COLOR_OFFSET = -12; const PEEK_INDEX_PROP = '_dtpPeekInitialIndex'; let headerHeight = 0; +let alphaBg = 0; let isLeftButtons = false; let isTopHeader = true; let scaleFactor = 1; @@ -168,12 +168,10 @@ var PreviewMenu = Utils.defineClass({ this.currentAppIcon = appIcon; if (!this.opened) { - let alpha = Math.max(MIN_MENU_ALPHA, this._panelWrapper.dynamicTransparency.alpha); - - this.menu.set_style('background: ' + Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alpha)); - this.show(); - this._refreshGlobals(); + this.menu.set_style('background: ' + Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alphaBg)); + + this.show(); } this._mergeWindows(appIcon); @@ -380,6 +378,12 @@ var PreviewMenu = Utils.defineClass({ size: this._dtpSettings.get_int('window-preview-aspect-ratio-y'), fixed: this._dtpSettings.get_boolean('window-preview-fixed-y') }; + + if (this._panelWrapper.dynamicTransparency) { + alphaBg = this._dtpSettings.get_boolean('preview-use-custom-opacity') ? + this._dtpSettings.get_int('preview-custom-opacity') * .01 : + this._panelWrapper.dynamicTransparency.alpha; + } }, _resetHiddenState: function() { @@ -680,7 +684,7 @@ var Preview = Utils.defineClass({ this._closeButtonBin.set_style( 'padding: ' + closeButtonPadding + 'px; ' + - this._getBackgroundColor(HEADER_COLOR_OFFSET, headerHeight ? 1 : MIN_MENU_ALPHA) + + this._getBackgroundColor(HEADER_COLOR_OFFSET, headerHeight ? 1 : .6) + closeButtonBorderRadius ); }, @@ -870,7 +874,7 @@ var Preview = Utils.defineClass({ alpha = Math.abs(alpha); if (isNaN(alpha)) { - alpha = Math.max(MIN_MENU_ALPHA, this._panelWrapper.dynamicTransparency.alpha); + alpha = alphaBg; } return Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alpha, offset);