fix lock binding loops caused by id/property name shadowing

This commit is contained in:
Damocles 2026-04-17 15:44:09 +02:00
parent e8a7469d47
commit d58d4b0078

View file

@ -11,17 +11,17 @@ Scope {
property string _sessionPath: "" property string _sessionPath: ""
WlSessionLock { WlSessionLock {
id: lock id: _lock
LockSurface { LockSurface {
lock: lock lock: _lock
auth: auth auth: _auth
} }
} }
LockAuth { LockAuth {
id: auth id: _auth
lock: lock lock: _lock
} }
// Resolve the actual logind session object path at startup // Resolve the actual logind session object path at startup
@ -55,7 +55,7 @@ Scope {
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
if (data.indexOf(".Lock ()") !== -1 && root._enabled) if (data.indexOf(".Lock ()") !== -1 && root._enabled)
lock.locked = true; _lock.locked = true;
// Unlock is PAM-driven, ignore logind Unlock signal // Unlock is PAM-driven, ignore logind Unlock signal
} }
} }
@ -64,11 +64,11 @@ Scope {
// Set logind LockedHint when lock state changes // Set logind LockedHint when lock state changes
Process { Process {
id: _lockedHint id: _lockedHint
command: ["busctl", "call", "--system", "org.freedesktop.login1", root._sessionPath || "/org/freedesktop/login1/session/auto", "org.freedesktop.login1.Session", "SetLockedHint", "b", lock.locked ? "true" : "false"] command: ["busctl", "call", "--system", "org.freedesktop.login1", root._sessionPath || "/org/freedesktop/login1/session/auto", "org.freedesktop.login1.Session", "SetLockedHint", "b", _lock.locked ? "true" : "false"]
} }
Connections { Connections {
target: lock target: _lock
function onLockStateChanged() { function onLockStateChanged() {
if (root._sessionPath) if (root._sessionPath)