usable
This commit is contained in:
58
config/aurora/modules/LockCtx.qml
Normal file
58
config/aurora/modules/LockCtx.qml
Normal file
@@ -0,0 +1,58 @@
|
||||
import Quickshell // for PanelWindow
|
||||
import QtQuick // for Text
|
||||
import QtQuick.Shapes
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.Pam
|
||||
|
||||
Scope {
|
||||
|
||||
id: root
|
||||
|
||||
property string pass
|
||||
|
||||
property bool busy: false
|
||||
|
||||
property bool failed: false
|
||||
|
||||
required property WlSessionLock lock
|
||||
|
||||
onPassChanged: failed = false
|
||||
|
||||
function unlock() {
|
||||
if(pass == "") return;
|
||||
|
||||
if(!busy) {
|
||||
root.busy = true
|
||||
pam.start()
|
||||
} else return;
|
||||
}
|
||||
|
||||
PamContext {
|
||||
|
||||
id: pam
|
||||
|
||||
onPamMessage: {
|
||||
if (this.responseRequired) {
|
||||
this.respond(root.pass);
|
||||
}
|
||||
}
|
||||
|
||||
onCompleted: result => {
|
||||
if (result == PamResult.Success) {
|
||||
lock.locked = false
|
||||
} else {
|
||||
root.pass = "";
|
||||
root.failed = true;
|
||||
}
|
||||
|
||||
root.busy = false;
|
||||
}
|
||||
|
||||
config: "aurora-lock.conf"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user