lock screen: ext-session-lock-v1 with PAM auth and logind integration
This commit is contained in:
parent
1f3cb60934
commit
4f59bc4ce4
10 changed files with 522 additions and 3 deletions
56
modules/lock/Lock.qml
Normal file
56
modules/lock/Lock.qml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import ".." as M
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
WlSessionLock {
|
||||
id: lock
|
||||
|
||||
LockSurface {
|
||||
lock: lock
|
||||
auth: auth
|
||||
}
|
||||
}
|
||||
|
||||
LockAuth {
|
||||
id: auth
|
||||
lock: lock
|
||||
}
|
||||
|
||||
// Listen for logind Lock/Unlock signals via busctl.
|
||||
// TODO: replace with native D-Bus integration when nova-stats becomes a quickshell plugin
|
||||
Process {
|
||||
id: _logindMonitor
|
||||
command: ["busctl", "monitor", "--system", "--match", "type='signal',interface='org.freedesktop.login1.Session',member='Lock'", "--match", "type='signal',interface='org.freedesktop.login1.Session',member='Unlock'", "--json=short"]
|
||||
running: true
|
||||
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
try {
|
||||
const msg = JSON.parse(data);
|
||||
if (msg.member === "Lock")
|
||||
lock.locked = true;
|
||||
// Unlock is PAM-driven, ignore logind Unlock signal
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set logind LockedHint when lock state changes
|
||||
Process {
|
||||
id: _lockedHint
|
||||
command: ["busctl", "call", "--system", "org.freedesktop.login1", "/org/freedesktop/login1/session/auto", "org.freedesktop.login1.Session", "SetLockedHint", "b", lock.locked ? "true" : "false"]
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: lock
|
||||
|
||||
function onLockStateChanged() {
|
||||
_lockedHint.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue