mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
IdleService: restore monitors when resuming from idle screen-off (fixes #2010)
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"]);
|
||||
}
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user