lockscreen: fix PAM never instantiating (moved out of WlSessionLock)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
57d4ea4e0f
commit
9239f60549
1 changed files with 23 additions and 11 deletions
|
|
@ -201,12 +201,18 @@ in
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
// ext-session-lock screen, replacing hyprlock. Lives in the shell
|
// ext-session-lock screen, replacing hyprlock. Set `locked: true`
|
||||||
// process: set `locked: true` and the compositor hands every
|
// and the compositor hands every screen to a LockSurface below
|
||||||
// screen to a LockSurface below until PAM says otherwise.
|
// until PAM says otherwise.
|
||||||
WlSessionLock {
|
//
|
||||||
id: lock
|
// 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 string password: ""
|
||||||
property bool failed: false
|
property bool failed: false
|
||||||
|
|
||||||
|
|
@ -223,15 +229,18 @@ in
|
||||||
// user's own password via the unix_chkpwd setuid wrapper.
|
// user's own password via the unix_chkpwd setuid wrapper.
|
||||||
config: "login"
|
config: "login"
|
||||||
onPamMessage: {
|
onPamMessage: {
|
||||||
if (this.responseRequired) this.respond(lock.password);
|
if (this.responseRequired) this.respond(root.password);
|
||||||
}
|
}
|
||||||
onCompleted: result => {
|
onCompleted: result => {
|
||||||
lock.password = "";
|
root.password = "";
|
||||||
if (result === PamResult.Success) lock.locked = false;
|
if (result === PamResult.Success) lock.locked = false;
|
||||||
else lock.failed = true;
|
else root.failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WlSessionLock {
|
||||||
|
id: lock
|
||||||
|
|
||||||
WlSessionLockSurface {
|
WlSessionLockSurface {
|
||||||
id: surface
|
id: surface
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
@ -289,7 +298,7 @@ in
|
||||||
color: Theme.cardBg
|
color: Theme.cardBg
|
||||||
border.width: Theme.borderWidth
|
border.width: Theme.borderWidth
|
||||||
border.color: pam.active ? Theme.base0D
|
border.color: pam.active ? Theme.base0D
|
||||||
: lock.failed ? Theme.base08
|
: root.failed ? Theme.base08
|
||||||
: Theme.base03
|
: Theme.base03
|
||||||
Behavior on border.color { ColorAnimation { duration: Theme.animFade } }
|
Behavior on border.color { ColorAnimation { duration: Theme.animFade } }
|
||||||
|
|
||||||
|
|
@ -307,7 +316,7 @@ in
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: pwInput.text === "" && lock.failed
|
visible: pwInput.text === "" && root.failed
|
||||||
text: "wrong password"
|
text: "wrong password"
|
||||||
color: Theme.base08
|
color: Theme.base08
|
||||||
font.family: Theme.fontFamily
|
font.family: Theme.fontFamily
|
||||||
|
|
@ -322,7 +331,7 @@ in
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
focus: true
|
focus: true
|
||||||
function go() {
|
function go() {
|
||||||
lock.submit(text);
|
root.submit(text);
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
// Explicit key handlers: accepted() doesn't
|
// Explicit key handlers: accepted() doesn't
|
||||||
|
|
@ -363,6 +372,7 @@ in
|
||||||
|
|
||||||
Component.onCompleted: pwInput.forceActiveFocus()
|
Component.onCompleted: pwInput.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
@ -422,6 +432,8 @@ in
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "lock"
|
target: "lock"
|
||||||
function lock(): void { root.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
|
// Screenshot pin: the Shift+Super+S keybind brackets hyprshot
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue