diff options
Diffstat (limited to 'accounts/gkleen@skadhi/shell')
5 files changed, 10 insertions, 6 deletions
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) { | |||
| 43 | this | 43 | this |
| 44 | ); | 44 | ); |
| 45 | 45 | ||
| 46 | QObject::connect(this->logindManager, &DBusLogindManager::PrepareForShutdown, this, &Systemd::shutdown); | 46 | QObject::connect(this->logindManager, &DBusLogindManager::PrepareForShutdown, this, &Systemd::prepareForShutdown); |
| 47 | QObject::connect(this->logindManager, &DBusLogindManager::PrepareForSleep, this, &Systemd::sleep); | 47 | QObject::connect(this->logindManager, &DBusLogindManager::PrepareForSleep, this, &Systemd::prepareForSleep); |
| 48 | QObject::connect(this->logindSession, &DBusLogindSession::Lock, this, &Systemd::lock); | 48 | QObject::connect(this->logindSession, &DBusLogindSession::Lock, this, &Systemd::lock); |
| 49 | QObject::connect(this->logindSession, &DBusLogindSession::Unlock, this, &Systemd::unlock); | 49 | QObject::connect(this->logindSession, &DBusLogindSession::Unlock, this, &Systemd::unlock); |
| 50 | QObject::connect(this->logindSessionProperties, &DBusProperties::PropertiesChanged, this, &Systemd::onLogindSessionPropertiesChanged); | 50 | QObject::connect(this->logindSessionProperties, &DBusProperties::PropertiesChanged, this, &Systemd::onLogindSessionPropertiesChanged); |
| @@ -148,6 +148,7 @@ void Systemd::setIdleHint(bool idle) { this->logindSession->SetIdleHint(idle); } | |||
| 148 | bool Systemd::lockedHint() { return this->logindSession->lockedHint(); } | 148 | bool Systemd::lockedHint() { return this->logindSession->lockedHint(); } |
| 149 | void Systemd::setLockedHint(bool locked) { this->logindSession->SetLockedHint(locked); } | 149 | void Systemd::setLockedHint(bool locked) { this->logindSession->SetLockedHint(locked); } |
| 150 | void Systemd::lockSession() { this->logindSession->call("Lock"); } | 150 | void Systemd::lockSession() { this->logindSession->call("Lock"); } |
| 151 | void Systemd::sleep() { this->logindManager->Sleep(true); } | ||
| 151 | void Systemd::suspend() { this->logindManager->Suspend(true); } | 152 | void Systemd::suspend() { this->logindManager->Suspend(true); } |
| 152 | void Systemd::hibernate() { this->logindManager->Hibernate(true); } | 153 | void Systemd::hibernate() { this->logindManager->Hibernate(true); } |
| 153 | 154 | ||
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: | |||
| 70 | Q_INVOKABLE void setIdleHint(bool idle); | 70 | Q_INVOKABLE void setIdleHint(bool idle); |
| 71 | Q_INVOKABLE void setLockedHint(bool locked); | 71 | Q_INVOKABLE void setLockedHint(bool locked); |
| 72 | Q_INVOKABLE void lockSession(); | 72 | Q_INVOKABLE void lockSession(); |
| 73 | Q_INVOKABLE void sleep(); | ||
| 73 | Q_INVOKABLE void suspend(); | 74 | Q_INVOKABLE void suspend(); |
| 74 | Q_INVOKABLE void hibernate(); | 75 | Q_INVOKABLE void hibernate(); |
| 75 | 76 | ||
| @@ -78,8 +79,8 @@ public: | |||
| 78 | ObjectModel<SystemdUnit>* userUnits(); | 79 | ObjectModel<SystemdUnit>* userUnits(); |
| 79 | 80 | ||
| 80 | signals: | 81 | signals: |
| 81 | void shutdown(bool before); | 82 | void prepareForShutdown(bool before); |
| 82 | void sleep(bool before); | 83 | void prepareForSleep(bool before); |
| 83 | void lock(); | 84 | void lock(); |
| 84 | void unlock(); | 85 | void unlock(); |
| 85 | void idleHintChanged(); | 86 | 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 { | |||
| 33 | 33 | ||
| 34 | Connections { | 34 | Connections { |
| 35 | target: Custom.Systemd | 35 | target: Custom.Systemd |
| 36 | function onSleep(before: bool) { | 36 | function onPrepareForSleep(before: bool) { |
| 37 | console.log(`received prepare for sleep ${before}`); | 37 | console.log(`received prepare for sleep ${before}`); |
| 38 | if (before) { | 38 | if (before) { |
| 39 | lock.locked = true; | 39 | 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 { | |||
| 22 | } | 22 | } |
| 23 | Connections { | 23 | Connections { |
| 24 | target: Custom.Systemd | 24 | target: Custom.Systemd |
| 25 | function onSleep(before: bool) { | 25 | function onPrepareForSleep(before: bool) { |
| 26 | if (!before) | 26 | if (!before) |
| 27 | NiriService.sendCommand({ "Action": { "PowerOnMonitors": {} } }, _ => {}); | 27 | NiriService.sendCommand({ "Action": { "PowerOnMonitors": {} } }, _ => {}); |
| 28 | } | 28 | } |
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 { | |||
| 31 | root.onCommandBrightness(command.Brightness); | 31 | root.onCommandBrightness(command.Brightness); |
| 32 | else if (command.LockSession) | 32 | else if (command.LockSession) |
| 33 | Custom.Systemd.lockSession(); | 33 | Custom.Systemd.lockSession(); |
| 34 | else if (command.Sleep) | ||
| 35 | Custom.Systemd.sleep(); | ||
| 34 | else if (command.Suspend) | 36 | else if (command.Suspend) |
| 35 | Custom.Systemd.suspend(); | 37 | Custom.Systemd.suspend(); |
| 36 | else if (command.Hibernate) | 38 | else if (command.Hibernate) |
