49 lines
2.3 KiB
Diff
49 lines
2.3 KiB
Diff
From: Tim Lunn <tim@feathertop.org>
|
|
Date: Wed, 20 Jun 2018 19:22:06 +0200
|
|
Subject: add support for the ubuntu lock on suspend option
|
|
|
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1063110
|
|
---
|
|
js/ui/screenShield.js | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
|
|
index f8c59fa..993e436 100644
|
|
--- a/js/ui/screenShield.js
|
|
+++ b/js/ui/screenShield.js
|
|
@@ -26,6 +26,7 @@ import {adjustAnimationTime} from '../misc/animationUtils.js';
|
|
const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
|
|
const LOCK_ENABLED_KEY = 'lock-enabled';
|
|
const LOCK_DELAY_KEY = 'lock-delay';
|
|
+const SUSPEND_LOCK_ENABLED_KEY = 'ubuntu-lock-on-suspend';
|
|
|
|
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
|
|
const DISABLE_LOCK_KEY = 'disable-lock-screen';
|
|
@@ -110,6 +111,7 @@ export class ScreenShield extends Signals.EventEmitter {
|
|
|
|
this._settings = new Gio.Settings({schema_id: SCREENSAVER_SCHEMA});
|
|
this._settings.connect(`changed::${LOCK_ENABLED_KEY}`, this._syncInhibitor.bind(this));
|
|
+ this._settings.connect(`changed::${SUSPEND_LOCK_ENABLED_KEY}`, this._syncInhibitor.bind(this));
|
|
|
|
this._lockSettings = new Gio.Settings({schema_id: LOCKDOWN_SCHEMA});
|
|
this._lockSettings.connect(`changed::${DISABLE_LOCK_KEY}`, this._syncInhibitor.bind(this));
|
|
@@ -215,7 +217,8 @@ export class ScreenShield extends Signals.EventEmitter {
|
|
}
|
|
|
|
async _syncInhibitor() {
|
|
- const lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
|
|
+ const lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY) ||
|
|
+ this._settings.get_boolean(SUSPEND_LOCK_ENABLED_KEY);
|
|
const lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
|
|
const inhibit = !!this._loginSession && this._loginSession.Active &&
|
|
!this._isActive && lockEnabled && !lockLocked &&
|
|
@@ -246,7 +249,7 @@ export class ScreenShield extends Signals.EventEmitter {
|
|
|
|
_prepareForSleep(loginManager, aboutToSuspend) {
|
|
if (aboutToSuspend) {
|
|
- if (this._settings.get_boolean(LOCK_ENABLED_KEY))
|
|
+ if (this._settings.get_boolean(SUSPEND_LOCK_ENABLED_KEY))
|
|
this.lock(true);
|
|
} else {
|
|
this._wakeUpScreen();
|