diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 45599eb..63be9e6 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -201,12 +201,18 @@ in import QtQuick import Qt5Compat.GraphicalEffects - // ext-session-lock screen, replacing hyprlock. Lives in the shell - // process: set `locked: true` and the compositor hands every - // screen to a LockSurface below until PAM says otherwise. - WlSessionLock { - id: lock + // ext-session-lock screen, replacing hyprlock. Set `locked: true` + // and the compositor hands every screen to a LockSurface below + // until PAM says otherwise. + // + // PAM and state live in a Scope OUTSIDE WlSessionLock: its default + // property is the surface *component*, so a PamContext declared + // inside it is never instantiated — `pam` didn't resolve and + // submit() threw, which is why enter/the arrow did nothing. + Scope { + id: root + property alias locked: lock.locked property string password: "" property bool failed: false @@ -223,15 +229,18 @@ in // user's own password via the unix_chkpwd setuid wrapper. config: "login" onPamMessage: { - if (this.responseRequired) this.respond(lock.password); + if (this.responseRequired) this.respond(root.password); } onCompleted: result => { - lock.password = ""; + root.password = ""; if (result === PamResult.Success) lock.locked = false; - else lock.failed = true; + else root.failed = true; } } + WlSessionLock { + id: lock + WlSessionLockSurface { id: surface color: "black" @@ -289,7 +298,7 @@ in color: Theme.cardBg border.width: Theme.borderWidth border.color: pam.active ? Theme.base0D - : lock.failed ? Theme.base08 + : root.failed ? Theme.base08 : Theme.base03 Behavior on border.color { ColorAnimation { duration: Theme.animFade } } @@ -307,7 +316,7 @@ in Text { anchors.centerIn: parent - visible: pwInput.text === "" && lock.failed + visible: pwInput.text === "" && root.failed text: "wrong password" color: Theme.base08 font.family: Theme.fontFamily @@ -322,7 +331,7 @@ in echoMode: TextInput.Password focus: true function go() { - lock.submit(text); + root.submit(text); text = ""; } // Explicit key handlers: accepted() doesn't @@ -363,6 +372,7 @@ in Component.onCompleted: pwInput.forceActiveFocus() } + } } ''; }; @@ -422,6 +432,8 @@ in IpcHandler { target: "lock" function lock(): void { root.lock(); } + // Escape hatch from a VT: qs ipc call lock unlock + function unlock(): void { lockScreen.locked = false; } } // Screenshot pin: the Shift+Super+S keybind brackets hyprshot