mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-23 19:45:21 -04:00
fix(greeter): avoid pinning auto-login session commands
- Store a desktop session identity instead of relying on raw Exec commands - Resolve the current session desktop file when auto-login launches - Preserve legacy memory compatibility while ignoring stale lastSessionExec - Add regression coverage for stale /nix/store session paths - Autologin users should rerun the process
This commit is contained in:
@@ -18,6 +18,7 @@ Singleton {
|
||||
readonly property bool rememberLastUser: GreetdEnv.readBoolOverride(Quickshell.env, ["DMS_GREET_REMEMBER_LAST_USER", "DMS_SAVE_USERNAME"], true)
|
||||
|
||||
property string lastSessionId: ""
|
||||
property string lastSessionDesktopId: ""
|
||||
property string lastSessionExec: ""
|
||||
property string lastSuccessfulUser: ""
|
||||
property bool memoryReady: false
|
||||
@@ -55,6 +56,7 @@ Singleton {
|
||||
return;
|
||||
const memory = JSON.parse(content);
|
||||
lastSessionId = rememberLastSession ? (memory.lastSessionId || "") : "";
|
||||
lastSessionDesktopId = rememberLastSession ? (memory.lastSessionDesktopId || "") : "";
|
||||
lastSessionExec = rememberLastSession ? (memory.lastSessionExec || "") : "";
|
||||
lastSuccessfulUser = rememberLastUser ? (memory.lastSuccessfulUser || "") : "";
|
||||
if (!rememberLastSession || !rememberLastUser)
|
||||
@@ -68,28 +70,39 @@ Singleton {
|
||||
let memory = {};
|
||||
if (rememberLastSession && lastSessionId)
|
||||
memory.lastSessionId = lastSessionId;
|
||||
if (rememberLastSession && lastSessionExec)
|
||||
memory.lastSessionExec = lastSessionExec;
|
||||
if (rememberLastSession && lastSessionDesktopId)
|
||||
memory.lastSessionDesktopId = lastSessionDesktopId;
|
||||
if (rememberLastUser && lastSuccessfulUser)
|
||||
memory.lastSuccessfulUser = lastSuccessfulUser;
|
||||
memoryFileView.setText(JSON.stringify(memory, null, 2));
|
||||
}
|
||||
|
||||
function setLastSessionId(id) {
|
||||
function setLastSession(id, desktopId) {
|
||||
if (!rememberLastSession) {
|
||||
if (lastSessionId !== "" || lastSessionExec !== "") {
|
||||
if (lastSessionId !== "" || lastSessionDesktopId !== "" || lastSessionExec !== "") {
|
||||
lastSessionId = "";
|
||||
lastSessionDesktopId = "";
|
||||
lastSessionExec = "";
|
||||
saveMemory();
|
||||
}
|
||||
return;
|
||||
}
|
||||
lastSessionId = id || "";
|
||||
lastSessionDesktopId = desktopId || "";
|
||||
lastSessionExec = "";
|
||||
if (!lastSessionId)
|
||||
lastSessionExec = "";
|
||||
lastSessionDesktopId = "";
|
||||
saveMemory();
|
||||
}
|
||||
|
||||
function setLastSessionId(id) {
|
||||
setLastSession(id, lastSessionDesktopId);
|
||||
}
|
||||
|
||||
function setLastSessionDesktopId(id) {
|
||||
setLastSession(lastSessionId, id);
|
||||
}
|
||||
|
||||
function setLastSessionExec(exec) {
|
||||
if (!rememberLastSession) {
|
||||
if (lastSessionExec !== "") {
|
||||
@@ -98,8 +111,10 @@ Singleton {
|
||||
}
|
||||
return;
|
||||
}
|
||||
lastSessionExec = exec || "";
|
||||
saveMemory();
|
||||
if (lastSessionExec !== "") {
|
||||
lastSessionExec = "";
|
||||
saveMemory();
|
||||
}
|
||||
}
|
||||
|
||||
function setLastSuccessfulUser(username) {
|
||||
|
||||
Reference in New Issue
Block a user