IdleService: restore monitors when resuming from idle screen-off (fixes #2010)

This commit is contained in:
Lysec
2026-03-01 10:53:05 +01:00
parent 5d03c56f4c
commit 300d12dade
7 changed files with 63 additions and 1 deletions
@@ -507,6 +507,15 @@ Singleton {
}
}
function turnOnMonitors() {
Logger.i("Compositor", "Turn on monitors requested");
if (backend && backend.turnOnMonitors) {
backend.turnOnMonitors();
} else {
Logger.w("Compositor", "No backend available for turnOnMonitors");
}
}
function suspend() {
Logger.i("Compositor", "Suspend requested");
if (executeSessionAction("suspend"))
+8
View File
@@ -490,6 +490,14 @@ Item {
}
}
function turnOnMonitors() {
try {
Quickshell.execDetached(["hyprctl", "dispatch", "dpms", "on"]);
} catch (e) {
Logger.e("HyprlandService", "Failed to turn on monitors:", e);
}
}
function logout() {
try {
Quickshell.execDetached(["hyprctl", "dispatch", "exit"]);
+8
View File
@@ -276,6 +276,14 @@ Item {
}
}
function turnOnMonitors() {
try {
Quickshell.execDetached(["wlr-randr", "--on"]);
} catch (e) {
Logger.e("LabwcService", "Failed to turn on monitors:", e);
}
}
function logout() {
stopWorkspaceHelper();
try {
+8
View File
@@ -678,6 +678,14 @@ Item {
}
}
function turnOnMonitors() {
try {
Quickshell.execDetached(["wlr-randr", "--on"]);
} catch (e) {
Logger.e("MangoService", "Failed to turn on monitors:", e);
}
}
function logout() {
Quickshell.execDetached(["mmsg", "-s", "-q"]);
}
+8
View File
@@ -480,6 +480,14 @@ Item {
}
}
function turnOnMonitors() {
try {
Quickshell.execDetached(["niri", "msg", "action", "power-on-monitors"]);
} catch (e) {
Logger.e("NiriService", "Failed to turn on monitors:", e);
}
}
function logout() {
try {
Quickshell.execDetached(["niri", "msg", "action", "quit", "--skip-confirmation"]);
+8
View File
@@ -561,6 +561,14 @@ Item {
}
}
function turnOnMonitors() {
try {
Quickshell.execDetached([msgCommand, "output", "*", "dpms", "on"]);
} catch (e) {
Logger.e("SwayService", "Failed to turn on monitors:", e);
}
}
function logout() {
try {
Quickshell.execDetached([msgCommand, "exit"]);
+14 -1
View File
@@ -42,6 +42,7 @@ Singleton {
property var _heartbeatMonitor: null
property var _customMonitors: ({})
property real _suppressUntil: 0
property bool _screenOffActive: false
// Signals for external listeners (plugins, modules)
signal screenOffRequested
@@ -83,12 +84,23 @@ Singleton {
// -------------------------------------------------------
function cancelFade() {
if (fadePending === "")
if (fadePending === "") {
_restoreMonitors();
return;
}
Logger.i("IdleService", "Fade cancelled for:", fadePending);
fadePending = "";
graceTimer.stop();
overlayCleanupTimer.stop();
_restoreMonitors();
}
function _restoreMonitors() {
if (!_screenOffActive)
return;
_screenOffActive = false;
Logger.i("IdleService", "Restoring monitors (DPMS on)");
CompositorService.turnOnMonitors();
}
function _onIdle(stage) {
@@ -106,6 +118,7 @@ Singleton {
if (stage === "screenOff") {
root._suppressUntil = Date.now() + (Settings.data.idle.screenOffTimeout * 1000);
CompositorService.turnOffMonitors();
root._screenOffActive = true;
root.screenOffRequested();
} else if (stage === "lock") {
if (PanelService.lockScreen && !PanelService.lockScreen.active) {