Allow restart/shutdown on lock screen

Resolves: https://issues.redhat.com/browse/RHEL-103984
This commit is contained in:
Joan Torres Lopez 2025-07-15 17:59:47 +02:00
parent 4cf439c61b
commit 98a51bfc2f
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From 193b664c7daa2ea7707e8b7fba03afe07e2cbd2a Mon Sep 17 00:00:00 2001
From: Joan Torres Lopez <joantolo@redhat.com>
Date: Tue, 15 Jul 2025 11:27:01 +0200
Subject: [PATCH] systemActions: Optionally allow restart/shutdown on lock
screen
Support the new 'restart-enabled' setting from 'org.gnome.desktop.screensaver'
to optionally allow restart/shutdown from the lock screen.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1584
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3797>
---
js/misc/systemActions.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js
index 10cab9a..9d3e09c 100644
--- a/js/misc/systemActions.js
+++ b/js/misc/systemActions.js
@@ -7,10 +7,12 @@ const Main = imports.ui.main;
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
const LOGIN_SCREEN_SCHEMA = 'org.gnome.login-screen';
+const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
const DISABLE_USER_SWITCH_KEY = 'disable-user-switching';
const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen';
const DISABLE_LOG_OUT_KEY = 'disable-log-out';
const DISABLE_RESTART_KEY = 'disable-restart-buttons';
+const RESTART_ENABLED_KEY = 'restart-enabled';
const ALWAYS_SHOW_LOG_OUT_KEY = 'always-show-log-out';
const POWER_OFF_ACTION_ID = 'power-off';
@@ -136,6 +138,7 @@ const SystemActions = GObject.registerClass({
this._loginScreenSettings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA });
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._orientationSettings = new Gio.Settings({ schema_id: 'org.gnome.settings-daemon.peripherals.touchscreen' });
+ this._screenSaverSettings = new Gio.Settings({schema_id: SCREENSAVER_SCHEMA});
this._session = new GnomeSession.SessionManager();
this._loginManager = LoginManager.getLoginManager();
@@ -165,6 +168,9 @@ const SystemActions = GObject.registerClass({
this._lockdownSettings.connect('changed::%s'.format(DISABLE_LOG_OUT_KEY),
() => this._updateHaveShutdown());
+ this._screenSaverSettings.connect(`changed::${RESTART_ENABLED_KEY}`,
+ () => this._updateHaveShutdown());
+
this.forceUpdate();
this._orientationSettings.connect('changed::orientation-lock', () => {
@@ -327,7 +333,8 @@ const SystemActions = GObject.registerClass({
}
_updatePowerOff() {
- let disabled = Main.sessionMode.isLocked ||
+ let disabled = (Main.sessionMode.isLocked &&
+ !this._screenSaverSettings.get_boolean(RESTART_ENABLED_KEY)) ||
(Main.sessionMode.isGreeter &&
this._loginScreenSettings.get_boolean(DISABLE_RESTART_KEY));
this._actions.get(POWER_OFF_ACTION_ID).available = this._canHavePowerOff && !disabled;
--
2.49.0

View File

@ -8,7 +8,7 @@
Name: gnome-shell
Version: 40.10
Release: 27%{?dist}
Release: 28%{?dist}
Summary: Window management and application launching for GNOME
License: GPLv2+
@ -35,6 +35,7 @@ Patch16: login-screen-extensions.patch
Patch17: fix-resetting-auth-prompt.patch
Patch18: 0001-authPrompt-Disregard-smartcard-status-changes-events.patch
Patch19: 0001-loginDialog-Show-session-menu-button-when-in-IN_PROG.patch
Patch20: 0001-systemActions-Optionally-allow-restart-shutdown-on-l.patch
# Misc.
Patch30: 0001-panel-add-an-icon-to-the-ActivitiesButton.patch
@ -303,6 +304,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de
%endif
%changelog
* Wed Jul 16 2025 Joan Torres <joantolo@redhat.com> - 40.10-28
- Allow restart/shutdown on lock screen
Resolves: RHEL-103984
* Thu Jun 19 2025 Joan Torres <joantolo@redhat.com> - 40.10-27
- session-opened signature is reverted to keep ABI compatibility,
use session-opened-with-session-id instead