From 0692d344b3cd37d989b2b7fa79ab2b41f9553768 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 26 May 2019 21:19:41 -0400 Subject: [PATCH] Tweak preview menu opacity --- panel.js | 1 + windowPreview.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/panel.js b/panel.js index 45d06a5..afdf0b3 100644 --- a/panel.js +++ b/panel.js @@ -158,6 +158,7 @@ var dtpPanelWrapper = Utils.defineClass({ //the timeout makes sure the theme's styles are computed before initially applying the transparency this.startDynamicTransparencyId = Mainloop.timeout_add(0, () => { + this.startDynamicTransparencyId = 0; this.dynamicTransparency = new Transparency.DynamicTransparency(this); }); diff --git a/windowPreview.js b/windowPreview.js index 934a549..be77894 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -41,6 +41,7 @@ const T3 = 'peekTimeout'; const MAX_TRANSLATION = 40; const HEADER_HEIGHT = 38; const DEFAULT_RATIO = { w: 160, h: 90 }; +const MIN_MENU_ALPHA = .5; const FOCUSED_COLOR_OFFSET = 24; const HEADER_COLOR_OFFSET = -12; const PEEK_INDEX_PROP = '_dtpPeekInitialIndex'; @@ -78,7 +79,7 @@ var PreviewMenu = Utils.defineClass({ reactive: true, track_hover: true, y_expand: true, - y_align: Clutter.ActorAlign.END + y_align: Clutter.ActorAlign[this._translationDirection > 0 ? 'END' : 'START'] }); this._box = new St.BoxLayout({ vertical: isLeftOrRight }); this._scrollView = new St.ScrollView({ @@ -161,7 +162,9 @@ var PreviewMenu = Utils.defineClass({ this.currentAppIcon = appIcon; if (!this.opened) { - this.menu.set_style('background: ' + this._panelWrapper.dynamicTransparency.currentBackgroundColor); + let alpha = Math.max(MIN_MENU_ALPHA, this._panelWrapper.dynamicTransparency.alpha); + + this.menu.set_style('background: ' + Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alpha)); this.menu.show(); this._refreshGlobals(); @@ -618,7 +621,7 @@ var Preview = Utils.defineClass({ layout_manager: new Clutter.BoxLayout(), x_expand: true, y_align: Clutter.ActorAlign[isTopHeader ? 'START' : 'END'], - style: this._getBackgroundColor(HEADER_COLOR_OFFSET, .8) + style: this._getBackgroundColor(HEADER_COLOR_OFFSET, 1) }); this._workspaceIndicator = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); @@ -659,7 +662,7 @@ var Preview = Utils.defineClass({ this._closeButtonBin.set_style( 'padding: ' + closeButtonPadding + 'px; ' + - this._getBackgroundColor(Math.abs(HEADER_COLOR_OFFSET), .8) + + this._getBackgroundColor(HEADER_COLOR_OFFSET, headerHeight ? 1 : MIN_MENU_ALPHA) + closeButtonBorderRadius ); }, @@ -846,7 +849,7 @@ var Preview = Utils.defineClass({ alpha = Math.abs(alpha); if (isNaN(alpha)) { - alpha = this._panelWrapper.dynamicTransparency.alpha; + alpha = Math.max(MIN_MENU_ALPHA, this._panelWrapper.dynamicTransparency.alpha); } return Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alpha, offset);