mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
greeter: init greeter
This commit is contained in:
parent
be06bf0f86
commit
fc9ced0bbe
6 changed files with 126 additions and 37 deletions
|
|
@ -1,3 +1,5 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pam
|
||||
|
|
@ -5,21 +7,14 @@ import Quickshell.Services.Pam
|
|||
Scope {
|
||||
id: root
|
||||
|
||||
property string currentText: ""
|
||||
property bool unlockInProgress: false
|
||||
property bool showFailure: false
|
||||
signal unlocked
|
||||
signal failed
|
||||
property LockState state: LockState {
|
||||
onTryUnlock: {
|
||||
if (this.currentText === "")
|
||||
return;
|
||||
|
||||
// Clear the failure text once the user starts typing.
|
||||
onCurrentTextChanged: showFailure = false
|
||||
|
||||
function tryUnlock() {
|
||||
if (currentText === "")
|
||||
return;
|
||||
|
||||
root.unlockInProgress = true;
|
||||
pam.start();
|
||||
this.unlockInProgress = true;
|
||||
pam.start();
|
||||
}
|
||||
}
|
||||
|
||||
PamContext {
|
||||
|
|
@ -34,20 +29,20 @@ Scope {
|
|||
// pam_unix will ask for a response for the password prompt
|
||||
onPamMessage: {
|
||||
if (this.responseRequired) {
|
||||
this.respond(root.currentText);
|
||||
this.respond(root.state.currentText);
|
||||
}
|
||||
}
|
||||
|
||||
// pam_unix won't send any important messages so all we need is the completion status.
|
||||
onCompleted: result => {
|
||||
if (result == PamResult.Success) {
|
||||
root.unlocked();
|
||||
root.currentText = "";
|
||||
root.state.unlocked();
|
||||
root.state.currentText = "";
|
||||
} else {
|
||||
root.showFailure = true;
|
||||
root.state.showFailure = true;
|
||||
}
|
||||
|
||||
root.unlockInProgress = false;
|
||||
root.state.unlockInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue