1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

lock: set LockedHint when locking with loginctl lock integration

- was previously read-only
fixes #2732
This commit is contained in:
bbedward
2026-07-02 22:57:09 -04:00
parent 31efe9b385
commit 186621ab81
4 changed files with 42 additions and 0 deletions
+13
View File
@@ -46,6 +46,19 @@ func (m *Manager) Activate() error {
return nil
}
func (m *Manager) SetLockedHint(locked bool) error {
err := m.sessionObj.Call(dbusSessionInterface+".SetLockedHint", 0, locked).Err
if err != nil {
if refreshErr := m.refreshSessionBinding(); refreshErr == nil {
err = m.sessionObj.Call(dbusSessionInterface+".SetLockedHint", 0, locked).Err
}
if err != nil {
return fmt.Errorf("failed to set locked hint: %w", err)
}
}
return nil
}
func (m *Manager) SetIdleHint(idle bool) error {
err := m.sessionObj.Call(dbusSessionInterface+".SetIdleHint", 0, idle).Err
if err != nil {
+16
View File
@@ -21,6 +21,8 @@ func HandleRequest(conn net.Conn, req models.Request, manager *Manager) {
handleActivate(conn, req, manager)
case "loginctl.setIdleHint":
handleSetIdleHint(conn, req, manager)
case "loginctl.setLockedHint":
handleSetLockedHint(conn, req, manager)
case "loginctl.setLockBeforeSuspend":
handleSetLockBeforeSuspend(conn, req, manager)
case "loginctl.setSleepInhibitorEnabled":
@@ -78,6 +80,20 @@ func handleSetIdleHint(conn net.Conn, req models.Request, manager *Manager) {
models.Respond(conn, req.ID, models.SuccessResult{Success: true, Message: "idle hint set"})
}
func handleSetLockedHint(conn net.Conn, req models.Request, manager *Manager) {
locked, err := params.Bool(req.Params, "locked")
if err != nil {
models.RespondError(conn, req.ID, err.Error())
return
}
if err := manager.SetLockedHint(locked); err != nil {
models.RespondError(conn, req.ID, err.Error())
return
}
models.Respond(conn, req.ID, models.SuccessResult{Success: true, Message: "locked hint set"})
}
func handleSetLockBeforeSuspend(conn net.Conn, req models.Request, manager *Manager) {
enabled, err := params.Bool(req.Params, "enabled")
if err != nil {
+7
View File
@@ -49,6 +49,12 @@ Scope {
lock();
}
function notifyLockedHint(locked: bool) {
if (!SettingsData.loginctlLockIntegration || !DMSService.isConnected)
return;
DMSService.setLockedHint(locked, () => {});
}
function notifyLoginctl(lockAction: bool) {
if (!SettingsData.loginctlLockIntegration || !DMSService.isConnected)
return;
@@ -217,6 +223,7 @@ Scope {
target: sessionLock
function onLockedChanged() {
notifyLockedHint(sessionLock.locked);
if (sessionLock.locked) {
pendingLock = false;
if (lockPowerOffArmed && SettingsData.lockScreenPowerOffMonitorsOnLock) {
+6
View File
@@ -620,6 +620,12 @@ Singleton {
sendRequest("loginctl.unlock", null, callback);
}
function setLockedHint(locked, callback) {
sendRequest("loginctl.setLockedHint", {
"locked": locked
}, callback);
}
function bluetoothPair(devicePath, callback) {
sendRequest("bluetooth.pair", {
"device": devicePath