This commit is contained in:
Ly-sec 2025-08-24 19:38:35 +02:00
parent 76626dc8da
commit 37dad3a255
4 changed files with 884 additions and 773 deletions

View file

@ -3,90 +3,90 @@ import Quickshell
import Quickshell.Services.Pam
Scope {
id: root
signal unlocked()
signal failed()
id: root
signal unlocked
signal failed
property string currentText: ""
property bool unlockInProgress: false
property bool showFailure: false
property string errorMessage: ""
property bool pamAvailable: typeof PamContext !== "undefined"
property string currentText: ""
property bool unlockInProgress: false
property bool showFailure: false
property string errorMessage: ""
property bool pamAvailable: typeof PamContext !== "undefined"
onCurrentTextChanged: {
if (currentText !== "") {
showFailure = false;
errorMessage = "";
}
onCurrentTextChanged: {
if (currentText !== "") {
showFailure = false
errorMessage = ""
}
}
function tryUnlock() {
if (!pamAvailable) {
errorMessage = "PAM not available"
showFailure = true
return
}
function tryUnlock() {
if (!pamAvailable) {
errorMessage = "PAM not available";
showFailure = true;
return;
}
if (currentText === "") {
errorMessage = "Password required";
showFailure = true;
return;
}
root.unlockInProgress = true;
errorMessage = "";
showFailure = false;
console.log("Starting PAM authentication for user:", pam.user);
pam.start();
if (currentText === "") {
errorMessage = "Password required"
showFailure = true
return
}
PamContext {
id: pam
config: "login"
user: Quickshell.env("USER")
root.unlockInProgress = true
errorMessage = ""
showFailure = false
onPamMessage: {
console.log("PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired);
if (messageIsError) {
errorMessage = message;
}
if (responseRequired) {
console.log("Responding to PAM with password");
respond(root.currentText);
}
}
console.log("Starting PAM authentication for user:", pam.user)
pam.start()
}
onResponseRequiredChanged: {
console.log("Response required changed:", responseRequired);
if (responseRequired && root.unlockInProgress) {
console.log("Automatically responding to PAM");
respond(root.currentText);
}
}
PamContext {
id: pam
config: "login"
user: Quickshell.env("USER")
onCompleted: {
console.log("PAM completed with result:", result);
if (result === PamResult.Success) {
console.log("Authentication successful");
root.unlocked();
} else {
console.log("Authentication failed");
errorMessage = "Authentication failed";
showFailure = true;
root.failed();
}
root.unlockInProgress = false;
}
onPamMessage: {
console.log("PAM message:", message, "isError:", messageIsError, "responseRequired:", responseRequired)
onError: {
console.log("PAM error:", error, "message:", message);
errorMessage = message || "Authentication error";
showFailure = true;
root.unlockInProgress = false;
root.failed();
}
if (messageIsError) {
errorMessage = message
}
if (responseRequired) {
console.log("Responding to PAM with password")
respond(root.currentText)
}
}
}
onResponseRequiredChanged: {
console.log("Response required changed:", responseRequired)
if (responseRequired && root.unlockInProgress) {
console.log("Automatically responding to PAM")
respond(root.currentText)
}
}
onCompleted: {
console.log("PAM completed with result:", result)
if (result === PamResult.Success) {
console.log("Authentication successful")
root.unlocked()
} else {
console.log("Authentication failed")
errorMessage = "Authentication failed"
showFailure = true
root.failed()
}
root.unlockInProgress = false
}
onError: {
console.log("PAM error:", error, "message:", message)
errorMessage = message || "Authentication error"
showFailure = true
root.unlockInProgress = false
root.failed()
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@ Variants {
// Only show on screens that have notifications enabled
visible: modelData ? (Settings.data.notifications.monitors.includes(modelData.name)
|| (Settings.data.notifications.monitors.length === 0)) : false
|| (Settings.data.notifications.monitors.length === 0)) : false
// Position based on bar location, like Notification popup does
anchors {
@ -57,7 +57,7 @@ Variants {
Component.onCompleted: {
// Only register toasts for screens that have notifications enabled
if (modelData ? (Settings.data.notifications.monitors.includes(modelData.name)
|| (Settings.data.notifications.monitors.length === 0)) : false) {
|| (Settings.data.notifications.monitors.length === 0)) : false) {
// Register this toast with the service
ToastService.allToasts.push(toast)

View file

@ -211,7 +211,7 @@ Singleton {
break
}
}
if (allDismissed) {
isShowingToast = false