From 43af16801fcbb7056a51ed5fd6539c74ff5c0379 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 12 Sep 2025 14:21:21 +0200 Subject: ... --- .../shell/quickshell-plugins/Systemd.cpp | 27 ++++++++-------------- .../shell/quickshell-plugins/Systemd.hpp | 3 +++ 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'accounts/gkleen@sif/shell/quickshell-plugins') diff --git a/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.cpp b/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.cpp index 884ea17f..308659e9 100644 --- a/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.cpp +++ b/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.cpp @@ -51,26 +51,17 @@ void Systemd::onLogindSessionPropertiesChanged(const QString& interface_name, co emit this->lockedHintChanged(); } -void Systemd::stopUserUnit(const QString& unit, const QString& mode) { - this->systemdManager->StopUnit(unit, mode); -} +void Systemd::stopUserUnit(const QString& unit, const QString& mode) { this->systemdManager->StopUnit(unit, mode); } -void Systemd::setBrightness(const QString& subsystem, const QString& name, quint32 brightness) { - this->logindSession->SetBrightness(subsystem, name, brightness); -} +void Systemd::setBrightness(const QString& subsystem, const QString& name, quint32 brightness) { this->logindSession->SetBrightness(subsystem, name, brightness); } -bool Systemd::idleHint() { - return this->logindSession->idleHint(); -} -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); -} +bool Systemd::idleHint() { return this->logindSession->idleHint(); } +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::suspend() { this->logindManager->Suspend(true); } +void Systemd::hibernate() { this->logindManager->Hibernate(true); } std::string SystemdInhibitorParams::toString(SystemdInhibitorParams::WhatItem what) { if (what == SystemdInhibitorParams::Shutdown) diff --git a/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.hpp b/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.hpp index 84752d76..615024d2 100644 --- a/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.hpp +++ b/accounts/gkleen@sif/shell/quickshell-plugins/Systemd.hpp @@ -28,6 +28,9 @@ public: Q_INVOKABLE void setBrightness(const QString& subsystem, const QString& name, quint32 brightness); Q_INVOKABLE void setIdleHint(bool idle); Q_INVOKABLE void setLockedHint(bool locked); + Q_INVOKABLE void lockSession(); + Q_INVOKABLE void suspend(); + Q_INVOKABLE void hibernate(); bool idleHint(); bool lockedHint(); -- cgit v1.2.3