mutter/debian/patches/ubuntu/lock_on_suspend.patch
Ward Nakchbandi (Cosmic Fusion) ebb234de19 initial push
2023-06-27 00:18:37 +03:00

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 b6c3c55..038c1df 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -22,6 +22,7 @@ const { adjustAnimationTime } = imports.ui.environment;
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';
@@ -106,6 +107,7 @@ var ScreenShield = class 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));
@@ -211,7 +213,8 @@ var ScreenShield = class 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 &&
@@ -242,7 +245,7 @@ var ScreenShield = class 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();