From e6b0b2a8664d0c057a7a32ef213e23e161da94aa Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 7 May 2019 13:24:52 -0400 Subject: [PATCH] Ensure theme styles are computed when applying transparency --- panel.js | 6 +++++- taskbar.js | 3 ++- transparency.js | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/panel.js b/panel.js index dee8509..df0f57c 100644 --- a/panel.js +++ b/panel.js @@ -156,7 +156,11 @@ var dtpPanelWrapper = Utils.defineClass({ if(this.appMenu) this.panel._leftBox.remove_child(this.appMenu.container); - this.dynamicTransparency = new Transparency.DynamicTransparency(this); + //the timeout makes sure the theme's styles are computed before initially applying the transparency + Mainloop.timeout_add(0, () => { + this.dynamicTransparency = new Transparency.DynamicTransparency(this); + }); + this.taskbar = new Taskbar.taskbar(this._dtpSettings, this); Main.overview.dashIconSize = this.taskbar.iconSize; diff --git a/taskbar.js b/taskbar.js index 19d3ca0..4ba093f 100644 --- a/taskbar.js +++ b/taskbar.js @@ -133,7 +133,8 @@ var taskbarActor = Utils.defineClass({ hupper = Math.floor(hupper); scrollview._dtpFadeSize = hupper > hpageSize ? this._delegate.iconSize : 0; - if (this._currentBackgroundColor !== this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor) { + if (this._delegate.panelWrapper.dynamicTransparency && + this._currentBackgroundColor !== this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor) { this._currentBackgroundColor = this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor; let gradientStart = 'background-gradient-start: ' + this._currentBackgroundColor; leftFade.set_style(gradientStart); diff --git a/transparency.js b/transparency.js index 4c1a92f..65389bb 100644 --- a/transparency.js +++ b/transparency.js @@ -144,6 +144,7 @@ var DynamicTransparency = Utils.defineClass({ this._updateColor(themeBackground); this._updateAlpha(themeBackground); + this._updateComplementaryStyles(); this._updateGradient(); this._setBackground(); this._setGradient(); @@ -164,6 +165,12 @@ var DynamicTransparency = Utils.defineClass({ this._setGradient(); }, + _updateComplementaryStyles: function() { + let panelThemeNode = this._dtpPanel.panel.actor.get_theme_node(); + + this._complementaryStyles = 'border-radius: ' + panelThemeNode.get_border_radius(0) + 'px;'; + }, + _updateColor: function(themeBackground) { this._backgroundColor = this._dtpSettings.get_boolean('trans-use-custom-bg') ? this._dtpSettings.get_string('trans-bg-color') : @@ -198,7 +205,7 @@ var DynamicTransparency = Utils.defineClass({ let transition = 'transition-duration:' + this._animationDuration; let cornerStyle = '-panel-corner-background-color: ' + this.currentBackgroundColor + transition; - this._dtpPanel.panelBg.set_style('background-color: ' + this.currentBackgroundColor + transition + this._dtpPanel.panelBg.styles); + this._dtpPanel.panelBg.set_style('background-color: ' + this.currentBackgroundColor + transition + this._complementaryStyles); this._dtpPanel.panel._leftCorner.actor.set_style(cornerStyle); this._dtpPanel.panel._rightCorner.actor.set_style(cornerStyle); },