From 98a0a0ec483b1c519bd3e4d9b50d592d050a7460 Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:15:49 +0000 Subject: Dim logo in overview Now that we added the brightness property, we can use it to dim the logo with the rest of the background. https://pagure.io/background-logo-extension/pull-request/17 --- diff --git a/extension.js b/extension.js index fc4a041..1cdc2d9 100644 --- a/extension.js +++ b/extension.js @@ -51,7 +51,7 @@ var BackgroundLogo = GObject.registerClass({ // For compatibility with Meta.BackgroundActor 'brightness': GObject.ParamSpec.double( 'brightness', 'brightness', 'brightness', - GObject.ParamFlags.READWRITE, + GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT, 0, 1, 1), 'vignette-sharpness': GObject.ParamSpec.double( 'vignette-sharpness', 'vignette-sharpness', 'vignette-sharpness', @@ -75,6 +75,8 @@ var BackgroundLogo = GObject.registerClass({ this._updatePosition.bind(this)); this._settings.connect('changed::logo-border', this._updateBorder.bind(this)); + this._settings.connect('changed::logo-opacity', + this._updateOpacity.bind(this)); this._settings.connect('changed::logo-always-visible', this._updateVisibility.bind(this)); @@ -93,6 +95,9 @@ var BackgroundLogo = GObject.registerClass({ this.connect('destroy', this._onDestroy.bind(this)); + this.connect('notify::brightness', + this._updateOpacity.bind(this)); + let constraint = new Layout.MonitorConstraint({ index: this._monitorIndex, work_area: true @@ -104,10 +109,6 @@ var BackgroundLogo = GObject.registerClass({ this._bin.connect('notify::resource-scale', this._updateLogoTexture.bind(this)); - this._settings.bind('logo-opacity', - this._bin, 'opacity', - Gio.SettingsBindFlags.DEFAULT); - this._updateLogo(); this._updatePosition(); this._updateBorder(); @@ -131,6 +132,11 @@ var BackgroundLogo = GObject.registerClass({ this._updateLogoTexture(); } + _updateOpacity() { + this._bin.opacity = + this._settings.get_uint('logo-opacity') * this.brightness; + } + _getWorkArea() { return Main.layoutManager.getWorkAreaForMonitor(this._monitorIndex); }