From 802be921966b70a59a38319b4418de451f57041b Mon Sep 17 00:00:00 2001 From: Colin Guthrie <colin@mageia.org> Date: Thu, 9 Oct 2014 19:32:04 +0100 Subject: [PATCH] screenShield: Allow for custom backgrounds on lock/login screen. Up until now the only customised backgrounds allowed was on the actual shield itself, not the actual password entry screens. This patch is based on a throw-away patch by Ray Strode which we used in Mageia to provide a little bit of customisation. By default the look+feel will be unaffected, but with appropriate settings (in the corresponding org.gnome.desktop.background.login schema added in gsettings-desktop-schemas) it can be customised to taste. --- data/theme/gnome-shell.css | 9 ++++----- js/ui/screenShield.js | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 843ed6c..9b71946 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -2590,14 +2590,13 @@ StScrollBar StButton#vhandle:active { background-color: rgba(0,0,0,0.3); } -.screen-shield-background { +.login-background { background: black; - box-shadow: 0px 4px 8px rgba(0,0,0,0.9); } -#lockDialogGroup { - background: #2e3436 url(noise-texture.png); - background-repeat: repeat; +.screen-shield-background { + background: black; + box-shadow: 0px 4px 8px rgba(0,0,0,0.9); } .screen-shield-arrows { diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 6c1bc5e..75709cb 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -29,6 +29,7 @@ const SmartcardManager = imports.misc.smartcardManager; const Tweener = imports.ui.tweener; const Util = imports.misc.util; +const LOGIN_SCHEMA = 'org.gnome.desktop.background.login'; const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver'; const LOCK_ENABLED_KEY = 'lock-enabled'; const LOCK_DELAY_KEY = 'lock-delay'; @@ -477,8 +478,12 @@ const ScreenShield = new Lang.Class({ this._lockScreenGroup.add_actor(this._lockScreenContents); - this._backgroundGroup = new Clutter.Actor(); + this._backgroundLoginGroup = new Clutter.Actor(); + this.actor.add_actor(this._backgroundLoginGroup); + this._backgroundLoginGroup.lower_bottom(); + this._bgLoginManagers = []; + this._backgroundGroup = new Clutter.Actor(); this._lockScreenGroup.add_actor(this._backgroundGroup); this._backgroundGroup.lower_bottom(); this._bgManagers = []; @@ -589,6 +594,24 @@ const ScreenShield = new Lang.Class({ this._cursorTracker = Meta.CursorTracker.get_for_screen(global.screen); }, + _createLoginBackground: function(monitorIndex) { + let monitor = Main.layoutManager.monitors[monitorIndex]; + let widget = new St.Widget({ style_class: 'login-background', + x: monitor.x, + y: monitor.y, + width: monitor.width, + height: monitor.height }); + + let bgManager = new Background.BackgroundManager({ container: widget, + monitorIndex: monitorIndex, + controlPosition: false, + settingsSchema: LOGIN_SCHEMA }); + + this._bgLoginManagers.push(bgManager); + + this._backgroundLoginGroup.add_child(widget); + }, + _createBackground: function(monitorIndex) { let monitor = Main.layoutManager.monitors[monitorIndex]; let widget = new St.Widget({ style_class: 'screen-shield-background', @@ -608,14 +631,21 @@ const ScreenShield = new Lang.Class({ }, _updateBackgrounds: function() { - for (let i = 0; i < this._bgManagers.length; i++) + for (let i = 0; i < this._bgManagers.length; i++) { + this._bgLoginManagers[i].destroy(); this._bgManagers[i].destroy(); + } + this._bgLoginManagers = []; this._bgManagers = []; + + this._backgroundLoginGroup.destroy_all_children(); this._backgroundGroup.destroy_all_children(); - for (let i = 0; i < Main.layoutManager.monitors.length; i++) + for (let i = 0; i < Main.layoutManager.monitors.length; i++) { + this._createLoginBackground(i); this._createBackground(i); + } }, _liftShield: function(onPrimary, velocity) { -- 2.1.2