From badf7aba844967c5d13e01079c12df758715167a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 27 Sep 2026 12:37:52 +0200 Subject: ... --- accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.cpp | 5 +++-- accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.hpp | 5 +++-- accounts/gkleen@skadhi/shell/quickshell/Lockscreen.qml | 2 +- accounts/gkleen@skadhi/shell/quickshell/NiriIdle.qml | 2 +- accounts/gkleen@skadhi/shell/quickshell/UnixIPC.qml | 2 ++ 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'accounts/gkleen@skadhi/shell') diff --git a/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.cpp b/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.cpp index 6376b527..1fa236f6 100644 --- a/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.cpp +++ b/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.cpp @@ -43,8 +43,8 @@ Systemd::Systemd(QObject* parent) : QObject(parent) { this ); - QObject::connect(this->logindManager, &DBusLogindManager::PrepareForShutdown, this, &Systemd::shutdown); - QObject::connect(this->logindManager, &DBusLogindManager::PrepareForSleep, this, &Systemd::sleep); + QObject::connect(this->logindManager, &DBusLogindManager::PrepareForShutdown, this, &Systemd::prepareForShutdown); + QObject::connect(this->logindManager, &DBusLogindManager::PrepareForSleep, this, &Systemd::prepareForSleep); QObject::connect(this->logindSession, &DBusLogindSession::Lock, this, &Systemd::lock); QObject::connect(this->logindSession, &DBusLogindSession::Unlock, this, &Systemd::unlock); QObject::connect(this->logindSessionProperties, &DBusProperties::PropertiesChanged, this, &Systemd::onLogindSessionPropertiesChanged); @@ -148,6 +148,7 @@ void Systemd::setIdleHint(bool idle) { this->logindSession->SetIdleHint(idle); } bool Systemd::lockedHint() { return this->logindSession->lockedHint(); } void Systemd::setLockedHint(bool locked) { this->logindSession->SetLockedHint(locked); } void Systemd::lockSession() { this->logindSession->call("Lock"); } +void Systemd::sleep() { this->logindManager->Sleep(true); } void Systemd::suspend() { this->logindManager->Suspend(true); } void Systemd::hibernate() { this->logindManager->Hibernate(true); } diff --git a/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.hpp b/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.hpp index 98f73d8f..52df6470 100644 --- a/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.hpp +++ b/accounts/gkleen@skadhi/shell/quickshell-plugins/Systemd.hpp @@ -70,6 +70,7 @@ public: Q_INVOKABLE void setIdleHint(bool idle); Q_INVOKABLE void setLockedHint(bool locked); Q_INVOKABLE void lockSession(); + Q_INVOKABLE void sleep(); Q_INVOKABLE void suspend(); Q_INVOKABLE void hibernate(); @@ -78,8 +79,8 @@ public: ObjectModel* userUnits(); signals: - void shutdown(bool before); - void sleep(bool before); + void prepareForShutdown(bool before); + void prepareForSleep(bool before); void lock(); void unlock(); void idleHintChanged(); diff --git a/accounts/gkleen@skadhi/shell/quickshell/Lockscreen.qml b/accounts/gkleen@skadhi/shell/quickshell/Lockscreen.qml index 0b4a68b2..373692df 100644 --- a/accounts/gkleen@skadhi/shell/quickshell/Lockscreen.qml +++ b/accounts/gkleen@skadhi/shell/quickshell/Lockscreen.qml @@ -33,7 +33,7 @@ Scope { Connections { target: Custom.Systemd - function onSleep(before: bool) { + function onPrepareForSleep(before: bool) { console.log(`received prepare for sleep ${before}`); if (before) { lock.locked = true; diff --git a/accounts/gkleen@skadhi/shell/quickshell/NiriIdle.qml b/accounts/gkleen@skadhi/shell/quickshell/NiriIdle.qml index beff205c..fb1cfa4d 100644 --- a/accounts/gkleen@skadhi/shell/quickshell/NiriIdle.qml +++ b/accounts/gkleen@skadhi/shell/quickshell/NiriIdle.qml @@ -22,7 +22,7 @@ Scope { } Connections { target: Custom.Systemd - function onSleep(before: bool) { + function onPrepareForSleep(before: bool) { if (!before) NiriService.sendCommand({ "Action": { "PowerOnMonitors": {} } }, _ => {}); } diff --git a/accounts/gkleen@skadhi/shell/quickshell/UnixIPC.qml b/accounts/gkleen@skadhi/shell/quickshell/UnixIPC.qml index 3d950031..483a60c6 100644 --- a/accounts/gkleen@skadhi/shell/quickshell/UnixIPC.qml +++ b/accounts/gkleen@skadhi/shell/quickshell/UnixIPC.qml @@ -31,6 +31,8 @@ Scope { root.onCommandBrightness(command.Brightness); else if (command.LockSession) Custom.Systemd.lockSession(); + else if (command.Sleep) + Custom.Systemd.sleep(); else if (command.Suspend) Custom.Systemd.suspend(); else if (command.Hibernate) -- cgit v1.2.3