mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-13 14:36:32 -04:00
feat(Greeter): add auto-login feature for startup settings
- Introduced a new cli flag: `dms greeter sync --autologin-only` and updated UI toggle in Greeter settings
This commit is contained in:
@@ -414,6 +414,7 @@ Singleton {
|
||||
property string lockDateFormat: ""
|
||||
property bool greeterRememberLastSession: true
|
||||
property bool greeterRememberLastUser: true
|
||||
property bool greeterAutoLogin: false
|
||||
property bool greeterEnableFprint: false
|
||||
property bool greeterEnableU2f: false
|
||||
property string greeterWallpaperPath: ""
|
||||
@@ -1333,6 +1334,15 @@ Singleton {
|
||||
});
|
||||
}
|
||||
|
||||
function scheduleGreeterAutoLoginSync() {
|
||||
if (isGreeterMode)
|
||||
return;
|
||||
Qt.callLater(() => {
|
||||
Processes.settingsRoot = root;
|
||||
Processes.scheduleGreeterAutoLoginSync();
|
||||
});
|
||||
}
|
||||
|
||||
readonly property var _hooks: ({
|
||||
"applyStoredTheme": applyStoredTheme,
|
||||
"regenSystemThemes": regenSystemThemes,
|
||||
@@ -1340,7 +1350,8 @@ Singleton {
|
||||
"applyStoredIconTheme": applyStoredIconTheme,
|
||||
"updateBarConfigs": updateBarConfigs,
|
||||
"updateCompositorCursor": updateCompositorCursor,
|
||||
"scheduleAuthApply": scheduleAuthApply
|
||||
"scheduleAuthApply": scheduleAuthApply,
|
||||
"scheduleGreeterAutoLoginSync": scheduleGreeterAutoLoginSync
|
||||
})
|
||||
|
||||
function set(key, value) {
|
||||
|
||||
@@ -12,6 +12,35 @@ Singleton {
|
||||
|
||||
property var settingsRoot: null
|
||||
|
||||
onSettingsRootChanged: {
|
||||
if (settingsRoot && !settingsRoot.isGreeterMode)
|
||||
consumeGreeterAutoLoginPendingSync();
|
||||
}
|
||||
|
||||
readonly property string greeterAutoLoginPendingSyncPath: (Quickshell.env("DMS_GREET_CFG_DIR") || "/var/cache/dms-greeter") + "/.local/state/auto-login-sync-pending"
|
||||
|
||||
function consumeGreeterAutoLoginPendingSync() {
|
||||
if (!settingsRoot || settingsRoot.isGreeterMode)
|
||||
return;
|
||||
greeterAutoLoginPendingCheckProcess.running = true;
|
||||
}
|
||||
|
||||
property var greeterAutoLoginPendingCheckProcess: Process {
|
||||
command: ["sh", "-c", "if [ -f " + JSON.stringify(root.greeterAutoLoginPendingSyncPath) + " ]; then rm -f " + JSON.stringify(root.greeterAutoLoginPendingSyncPath) + "; echo pending; fi"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if ((text || "").trim() !== "pending" || !root.settingsRoot)
|
||||
return;
|
||||
if (!root.settingsRoot.greeterAutoLogin)
|
||||
root.settingsRoot.set("greeterAutoLogin", true);
|
||||
else
|
||||
root.scheduleGreeterAutoLoginSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property string greetdPamText: ""
|
||||
property string systemAuthPamText: ""
|
||||
property string commonAuthPamText: ""
|
||||
@@ -296,6 +325,66 @@ Singleton {
|
||||
authApplyDebounce.restart();
|
||||
}
|
||||
|
||||
// --- Greeter auto-login sync pipeline ---
|
||||
|
||||
property bool greeterAutoLoginSyncRunning: false
|
||||
property bool greeterAutoLoginSyncQueued: false
|
||||
property bool greeterAutoLoginSyncRerunRequested: false
|
||||
property string greeterAutoLoginSyncStdout: ""
|
||||
property string greeterAutoLoginSyncStderr: ""
|
||||
property string greeterAutoLoginSyncTerminalFallbackStderr: ""
|
||||
|
||||
function scheduleGreeterAutoLoginSync() {
|
||||
if (!settingsRoot || settingsRoot.isGreeterMode)
|
||||
return;
|
||||
|
||||
greeterAutoLoginSyncQueued = true;
|
||||
if (greeterAutoLoginSyncRunning) {
|
||||
greeterAutoLoginSyncRerunRequested = true;
|
||||
return;
|
||||
}
|
||||
|
||||
greeterAutoLoginSyncDebounce.restart();
|
||||
}
|
||||
|
||||
function beginGreeterAutoLoginSync() {
|
||||
if (!greeterAutoLoginSyncQueued || greeterAutoLoginSyncRunning || !settingsRoot || settingsRoot.isGreeterMode)
|
||||
return;
|
||||
|
||||
greeterAutoLoginSyncQueued = false;
|
||||
greeterAutoLoginSyncRerunRequested = false;
|
||||
greeterAutoLoginSyncStdout = "";
|
||||
greeterAutoLoginSyncStderr = "";
|
||||
greeterAutoLoginSyncTerminalFallbackStderr = "";
|
||||
greeterAutoLoginSyncRunning = true;
|
||||
greeterAutoLoginSyncSudoProbeProcess.running = true;
|
||||
}
|
||||
|
||||
function launchGreeterAutoLoginSyncTerminalFallback(details) {
|
||||
ToastService.showWarning(I18n.tr("Opening terminal to update greetd"), I18n.tr("DMS needs administrator access. The terminal closes automatically when done.") + (details ? "\n\n" + details : ""), "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
||||
greeterAutoLoginSyncTerminalFallbackStderr = "";
|
||||
greeterAutoLoginSyncTerminalFallbackProcess.running = true;
|
||||
}
|
||||
|
||||
function greeterAutoLoginSyncSuccessToast(details) {
|
||||
const enabling = settingsRoot && settingsRoot.greeterAutoLogin;
|
||||
// Clear the sticky in-progress toast, then confirm with an auto-dismissing toast.
|
||||
ToastService.dismissCategory("greeter-autologin-sync");
|
||||
if (enabling) {
|
||||
ToastService.showWarning(I18n.tr("Auto-login enabled"), I18n.tr("You'll skip the greeter password after the next reboot. The lock screen and signing out still require your password.") + (details ? "\n\n" + details : ""));
|
||||
} else {
|
||||
ToastService.showInfo(I18n.tr("Auto-login disabled"), I18n.tr("You'll enter your password at the greeter after the next reboot.") + (details ? "\n\n" + details : ""));
|
||||
}
|
||||
}
|
||||
|
||||
function finishGreeterAutoLoginSync() {
|
||||
const shouldRerun = greeterAutoLoginSyncQueued || greeterAutoLoginSyncRerunRequested;
|
||||
greeterAutoLoginSyncRunning = false;
|
||||
greeterAutoLoginSyncRerunRequested = false;
|
||||
if (shouldRerun)
|
||||
greeterAutoLoginSyncDebounce.restart();
|
||||
}
|
||||
|
||||
// --- PAM parsing helpers ---
|
||||
|
||||
function stripPamComment(line) {
|
||||
@@ -433,6 +522,82 @@ Singleton {
|
||||
onTriggered: root.beginAuthApply()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: greeterAutoLoginSyncDebounce
|
||||
interval: 300
|
||||
repeat: false
|
||||
onTriggered: root.beginGreeterAutoLoginSync()
|
||||
}
|
||||
|
||||
property var greeterAutoLoginSyncProcess: Process {
|
||||
command: ["dms", "greeter", "sync", "--yes", "--autologin-only"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.greeterAutoLoginSyncStdout = text || ""
|
||||
}
|
||||
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: root.greeterAutoLoginSyncStderr = text || ""
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
const out = (root.greeterAutoLoginSyncStdout || "").trim();
|
||||
const err = (root.greeterAutoLoginSyncStderr || "").trim();
|
||||
|
||||
if (exitCode === 0) {
|
||||
let details = out;
|
||||
if (err !== "")
|
||||
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
||||
root.greeterAutoLoginSyncSuccessToast(details);
|
||||
root.finishGreeterAutoLoginSync();
|
||||
return;
|
||||
}
|
||||
|
||||
let details = "";
|
||||
if (out !== "")
|
||||
details = out;
|
||||
if (err !== "")
|
||||
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
||||
root.launchGreeterAutoLoginSyncTerminalFallback(details);
|
||||
}
|
||||
}
|
||||
|
||||
property var greeterAutoLoginSyncSudoProbeProcess: Process {
|
||||
command: ["sudo", "-n", "true"]
|
||||
running: false
|
||||
|
||||
onExited: exitCode => {
|
||||
const enabling = root.settingsRoot && root.settingsRoot.greeterAutoLogin;
|
||||
if (exitCode === 0) {
|
||||
ToastService.showWarning(enabling ? I18n.tr("Applying auto-login on startup…") : I18n.tr("Disabling auto-login on startup…"), "", "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
||||
root.greeterAutoLoginSyncProcess.running = true;
|
||||
return;
|
||||
}
|
||||
|
||||
root.launchGreeterAutoLoginSyncTerminalFallback();
|
||||
}
|
||||
}
|
||||
|
||||
property var greeterAutoLoginSyncTerminalFallbackProcess: Process {
|
||||
command: ["dms", "greeter", "sync", "--terminal", "--yes", "--autologin-only"]
|
||||
running: false
|
||||
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: root.greeterAutoLoginSyncTerminalFallbackStderr = text || ""
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode === 0) {
|
||||
root.greeterAutoLoginSyncSuccessToast("");
|
||||
} else {
|
||||
let details = (root.greeterAutoLoginSyncTerminalFallbackStderr || "").trim();
|
||||
ToastService.showError(I18n.tr("Couldn't open a terminal for the auto-login update.") + " (exit " + exitCode + ")", details, "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
||||
}
|
||||
root.finishGreeterAutoLoginSync();
|
||||
}
|
||||
}
|
||||
|
||||
property var authApplyProcess: Process {
|
||||
command: ["dms", "auth", "sync", "--yes"]
|
||||
running: false
|
||||
|
||||
@@ -182,6 +182,7 @@ var SPEC = {
|
||||
lockDateFormat: { def: "" },
|
||||
greeterRememberLastSession: { def: true },
|
||||
greeterRememberLastUser: { def: true },
|
||||
greeterAutoLogin: { def: false, onChange: "scheduleGreeterAutoLoginSync" },
|
||||
greeterEnableFprint: { def: false, onChange: "scheduleAuthApply" },
|
||||
greeterEnableU2f: { def: false, onChange: "scheduleAuthApply" },
|
||||
greeterWallpaperPath: { def: "" },
|
||||
|
||||
@@ -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 lastSessionExec: ""
|
||||
property string lastSuccessfulUser: ""
|
||||
property bool memoryReady: false
|
||||
property bool isLightMode: false
|
||||
@@ -54,6 +55,7 @@ Singleton {
|
||||
return;
|
||||
const memory = JSON.parse(content);
|
||||
lastSessionId = rememberLastSession ? (memory.lastSessionId || "") : "";
|
||||
lastSessionExec = rememberLastSession ? (memory.lastSessionExec || "") : "";
|
||||
lastSuccessfulUser = rememberLastUser ? (memory.lastSuccessfulUser || "") : "";
|
||||
if (!rememberLastSession || !rememberLastUser)
|
||||
saveMemory();
|
||||
@@ -66,6 +68,8 @@ Singleton {
|
||||
let memory = {};
|
||||
if (rememberLastSession && lastSessionId)
|
||||
memory.lastSessionId = lastSessionId;
|
||||
if (rememberLastSession && lastSessionExec)
|
||||
memory.lastSessionExec = lastSessionExec;
|
||||
if (rememberLastUser && lastSuccessfulUser)
|
||||
memory.lastSuccessfulUser = lastSuccessfulUser;
|
||||
memoryFileView.setText(JSON.stringify(memory, null, 2));
|
||||
@@ -73,13 +77,28 @@ Singleton {
|
||||
|
||||
function setLastSessionId(id) {
|
||||
if (!rememberLastSession) {
|
||||
if (lastSessionId !== "") {
|
||||
if (lastSessionId !== "" || lastSessionExec !== "") {
|
||||
lastSessionId = "";
|
||||
lastSessionExec = "";
|
||||
saveMemory();
|
||||
}
|
||||
return;
|
||||
}
|
||||
lastSessionId = id || "";
|
||||
if (!lastSessionId)
|
||||
lastSessionExec = "";
|
||||
saveMemory();
|
||||
}
|
||||
|
||||
function setLastSessionExec(exec) {
|
||||
if (!rememberLastSession) {
|
||||
if (lastSessionExec !== "") {
|
||||
lastSessionExec = "";
|
||||
saveMemory();
|
||||
}
|
||||
return;
|
||||
}
|
||||
lastSessionExec = exec || "";
|
||||
saveMemory();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ Singleton {
|
||||
property bool lockScreenShowProfileImage: true
|
||||
property bool rememberLastSession: true
|
||||
property bool rememberLastUser: true
|
||||
property bool greeterAutoLogin: false
|
||||
property bool greeterEnableFprint: false
|
||||
property bool greeterEnableU2f: false
|
||||
property string greeterWallpaperPath: ""
|
||||
@@ -132,6 +133,9 @@ Singleton {
|
||||
} else {
|
||||
rememberLastUser = settings.greeterRememberLastUser !== undefined ? settings.greeterRememberLastUser : settings.rememberLastUser !== undefined ? settings.rememberLastUser : true;
|
||||
}
|
||||
if (configBaseDir === root._greeterCacheDir) {
|
||||
greeterAutoLogin = settings.greeterAutoLogin !== undefined ? settings.greeterAutoLogin : false;
|
||||
}
|
||||
greeterEnableFprint = settings.greeterEnableFprint !== undefined ? settings.greeterEnableFprint : false;
|
||||
greeterEnableU2f = settings.greeterEnableU2f !== undefined ? settings.greeterEnableU2f : false;
|
||||
greeterWallpaperPath = settings.greeterWallpaperPath !== undefined ? settings.greeterWallpaperPath : "";
|
||||
|
||||
@@ -57,6 +57,7 @@ Item {
|
||||
property int maxPasswordSessionTransitionRetries: 2
|
||||
property bool fprintdProbeComplete: false
|
||||
property bool fprintdHasDevice: false
|
||||
property bool autoLoginOnSuccess: false
|
||||
// Falls back to PAM-only detection until the fprintd D-Bus probe completes.
|
||||
readonly property bool greeterPamHasFprint: greeterPamStackHasModule("pam_fprintd") && (!fprintdProbeComplete || fprintdHasDevice)
|
||||
readonly property bool greeterPamHasU2f: greeterPamStackHasModule("pam_u2f")
|
||||
@@ -524,6 +525,7 @@ Item {
|
||||
passwordFailureCount = 0;
|
||||
clearAuthFeedback();
|
||||
externalAuthAutoStartedForUser = "";
|
||||
root.autoLoginOnSuccess = false;
|
||||
}
|
||||
root.pickerThemeUsername = user;
|
||||
GreeterState.username = user;
|
||||
@@ -646,6 +648,12 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: greeterAutoLoginPendingProcess
|
||||
command: ["sh", "-c", "mkdir -p $(dirname " + JSON.stringify((Quickshell.env("DMS_GREET_CFG_DIR") || "/var/cache/dms-greeter") + "/.local/state/auto-login-sync-pending") + ") && touch " + JSON.stringify((Quickshell.env("DMS_GREET_CFG_DIR") || "/var/cache/dms-greeter") + "/.local/state/auto-login-sync-pending")]
|
||||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: hyprlandLayoutProcess
|
||||
running: false
|
||||
@@ -870,110 +878,110 @@ Item {
|
||||
anchors.top: parent.top
|
||||
spacing: 0
|
||||
|
||||
property string fullTimeStr: {
|
||||
const format = GreetdSettings.getEffectiveTimeFormat();
|
||||
return systemClock.date.toLocaleTimeString(I18n.locale(), format);
|
||||
}
|
||||
property var timeParts: fullTimeStr.split(':')
|
||||
property string hours: timeParts[0] || ""
|
||||
property string minutes: timeParts[1] || ""
|
||||
property string secondsWithAmPm: timeParts.length > 2 ? timeParts[2] : ""
|
||||
property string seconds: secondsWithAmPm.replace(/\s*(AM|PM|am|pm)$/i, '')
|
||||
property string ampm: {
|
||||
const match = fullTimeStr.match(/\s*(AM|PM|am|pm)$/i);
|
||||
return match ? match[0].trim() : "";
|
||||
}
|
||||
property bool hasSeconds: timeParts.length > 2
|
||||
property string fullTimeStr: {
|
||||
const format = GreetdSettings.getEffectiveTimeFormat();
|
||||
return systemClock.date.toLocaleTimeString(I18n.locale(), format);
|
||||
}
|
||||
property var timeParts: fullTimeStr.split(':')
|
||||
property string hours: timeParts[0] || ""
|
||||
property string minutes: timeParts[1] || ""
|
||||
property string secondsWithAmPm: timeParts.length > 2 ? timeParts[2] : ""
|
||||
property string seconds: secondsWithAmPm.replace(/\s*(AM|PM|am|pm)$/i, '')
|
||||
property string ampm: {
|
||||
const match = fullTimeStr.match(/\s*(AM|PM|am|pm)$/i);
|
||||
return match ? match[0].trim() : "";
|
||||
}
|
||||
property bool hasSeconds: timeParts.length > 2
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hours.length > 1 ? clockText.hours[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hours.length > 1 ? clockText.hours[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hours.length > 1 ? clockText.hours[1] : clockText.hours.length > 0 ? clockText.hours[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hours.length > 1 ? clockText.hours[1] : clockText.hours.length > 0 ? clockText.hours[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: ":"
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
}
|
||||
StyledText {
|
||||
text: ":"
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.minutes.length > 0 ? clockText.minutes[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.minutes.length > 0 ? clockText.minutes[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.minutes.length > 1 ? clockText.minutes[1] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.minutes.length > 1 ? clockText.minutes[1] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: clockText.hasSeconds ? ":" : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
StyledText {
|
||||
text: clockText.hasSeconds ? ":" : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hasSeconds && clockText.seconds.length > 0 ? clockText.seconds[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hasSeconds && clockText.seconds.length > 0 ? clockText.seconds[0] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hasSeconds && clockText.seconds.length > 1 ? clockText.seconds[1] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
StyledText {
|
||||
width: 75
|
||||
text: clockText.hasSeconds && clockText.seconds.length > 1 ? clockText.seconds[1] : ""
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: clockText.hasSeconds
|
||||
}
|
||||
|
||||
StyledText {
|
||||
width: 20
|
||||
text: " "
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.ampm !== ""
|
||||
}
|
||||
StyledText {
|
||||
width: 20
|
||||
text: " "
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.ampm !== ""
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: clockText.ampm
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.ampm !== ""
|
||||
StyledText {
|
||||
text: clockText.ampm
|
||||
font.pixelSize: 120
|
||||
font.weight: Font.Light
|
||||
color: "white"
|
||||
visible: clockText.ampm !== ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: dateText
|
||||
@@ -1355,7 +1363,7 @@ Item {
|
||||
|
||||
StyledText {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 38
|
||||
Layout.preferredHeight: root.authFeedbackMessage !== "" ? 38 : 0
|
||||
Layout.topMargin: -Theme.spacingS
|
||||
Layout.bottomMargin: -Theme.spacingS
|
||||
text: root.authFeedbackMessage
|
||||
@@ -1374,48 +1382,150 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: 0
|
||||
Layout.preferredWidth: switchUserRow.width + Theme.spacingL * 2
|
||||
Layout.preferredHeight: 40
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainer
|
||||
opacity: GreeterState.showPasswordInput ? 1 : 0
|
||||
enabled: GreeterState.showPasswordInput
|
||||
// Password-screen actions: Switch User + Auto-login toggle as one compact chip row
|
||||
Item {
|
||||
id: passwordActions
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
readonly property bool autoLoginAvailable: GreetdSettings.rememberLastUser && GreetdSettings.rememberLastSession
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Theme.spacingXS
|
||||
Layout.preferredHeight: visible ? 32 : 0
|
||||
visible: GreeterState.showPasswordInput && !GreeterState.unlocking && (root.multipleUsersAvailable || autoLoginAvailable)
|
||||
|
||||
Row {
|
||||
id: switchUserRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: "people"
|
||||
size: Theme.iconSize - 4
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Rectangle {
|
||||
id: switchUserChip
|
||||
|
||||
visible: root.multipleUsersAvailable
|
||||
height: 32
|
||||
width: switchUserContent.implicitWidth + Theme.spacingM * 2
|
||||
radius: height / 2
|
||||
color: Theme.withAlpha(Theme.surfaceVariant, 0.65)
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: parent.radius
|
||||
color: (switchUserMouse.containsMouse || switchUserMouse.pressed) ? Theme.surfaceTextHover : "transparent"
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shorterDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankRipple {
|
||||
id: switchUserRipple
|
||||
cornerRadius: switchUserChip.radius
|
||||
rippleColor: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
Row {
|
||||
id: switchUserContent
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
DankIcon {
|
||||
name: "people"
|
||||
size: 16
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Switch User")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: switchUserMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => switchUserRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: root.returnToUserPicker()
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Switch User")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: autoLoginChip
|
||||
|
||||
StateLayer {
|
||||
stateColor: Theme.primary
|
||||
cornerRadius: parent.radius
|
||||
enabled: !GreeterState.unlocking && GreeterState.showPasswordInput
|
||||
onClicked: root.returnToUserPicker()
|
||||
visible: passwordActions.autoLoginAvailable
|
||||
height: 32
|
||||
width: autoLoginContent.implicitWidth + Theme.spacingM * 2
|
||||
radius: height / 2
|
||||
color: root.autoLoginOnSuccess ? Theme.withAlpha(Theme.primary, 0.85) : Theme.withAlpha(Theme.surfaceVariant, 0.65)
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: parent.radius
|
||||
color: {
|
||||
if (autoLoginMouse.pressed)
|
||||
return root.autoLoginOnSuccess ? Theme.primaryPressed : Theme.surfaceTextHover;
|
||||
if (autoLoginMouse.containsMouse)
|
||||
return root.autoLoginOnSuccess ? Theme.primaryHover : Theme.surfaceTextHover;
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shorterDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankRipple {
|
||||
id: autoLoginRipple
|
||||
cornerRadius: autoLoginChip.radius
|
||||
rippleColor: root.autoLoginOnSuccess ? Theme.primaryText : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
Row {
|
||||
id: autoLoginContent
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
DankIcon {
|
||||
name: root.autoLoginOnSuccess ? "check" : "login"
|
||||
size: 16
|
||||
color: root.autoLoginOnSuccess ? Theme.primaryText : Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Auto-login")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: root.autoLoginOnSuccess ? Font.Medium : Font.Normal
|
||||
color: root.autoLoginOnSuccess ? Theme.primaryText : Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: autoLoginMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.autoLoginOnSuccess = !root.autoLoginOnSuccess
|
||||
onPressed: mouse => autoLoginRipple.trigger(mouse.x, mouse.y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1984,7 +2094,8 @@ Item {
|
||||
launchTimeout.restart();
|
||||
if (GreetdSettings.rememberLastSession) {
|
||||
GreetdMemory.setLastSessionId(sessionPath);
|
||||
} else if (GreetdMemory.lastSessionId) {
|
||||
GreetdMemory.setLastSessionExec(sessionCmd);
|
||||
} else if (GreetdMemory.lastSessionId || GreetdMemory.lastSessionExec) {
|
||||
GreetdMemory.setLastSessionId("");
|
||||
}
|
||||
if (GreetdSettings.rememberLastUser) {
|
||||
@@ -1992,6 +2103,8 @@ Item {
|
||||
} else if (GreetdMemory.lastSuccessfulUser) {
|
||||
GreetdMemory.setLastSuccessfulUser("");
|
||||
}
|
||||
if (root.autoLoginOnSuccess)
|
||||
greeterAutoLoginPendingProcess.running = true;
|
||||
pendingLaunchCommand = sessionCmd;
|
||||
pendingLaunchEnv = ["XDG_SESSION_TYPE=wayland"];
|
||||
memoryFlushTimer.restart();
|
||||
|
||||
@@ -743,6 +743,16 @@ Item {
|
||||
checked: SettingsData.greeterRememberLastUser
|
||||
onToggled: checked => SettingsData.set("greeterRememberLastUser", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "greeterAutoLogin"
|
||||
tags: ["greeter", "autologin", "login", "startup", "password"]
|
||||
text: I18n.tr("Auto-login on startup")
|
||||
description: SettingsData.greeterRememberLastUser && SettingsData.greeterRememberLastSession ? I18n.tr("Skip the greeter password after boot until you sign out. Lock screen unlock is unchanged. Takes effect on the next reboot after sync.") : I18n.tr("Requires remembering the last user and session. Enable those options first.")
|
||||
checked: SettingsData.greeterAutoLogin
|
||||
enabled: SettingsData.greeterRememberLastUser && SettingsData.greeterRememberLastSession
|
||||
onToggled: checked => SettingsData.set("greeterAutoLogin", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
|
||||
@@ -50,7 +50,7 @@ PanelWindow {
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
color: "transparent"
|
||||
|
||||
readonly property real toastWidth: shouldBeVisible ? Theme.px(Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + (ToastService.hasDetails ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2), dpr) : frozenWidth
|
||||
readonly property real toastWidth: shouldBeVisible ? Theme.px(Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + ((ToastService.hasDetails || ToastService.isStickyCategory(ToastService.currentCategory)) ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2), dpr) : frozenWidth
|
||||
readonly property real toastHeight: Theme.px(toastContent.height + Theme.spacingL * 2, dpr)
|
||||
|
||||
anchors {
|
||||
@@ -208,7 +208,7 @@ PanelWindow {
|
||||
buttonSize: Theme.iconSize + 8
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: ToastService.hasDetails || ToastService.currentLevel === ToastService.levelError
|
||||
visible: ToastService.hasDetails || ToastService.currentLevel === ToastService.levelError || ToastService.isStickyCategory(ToastService.currentCategory)
|
||||
|
||||
onClicked: {
|
||||
ToastService.hideToast();
|
||||
@@ -400,7 +400,7 @@ PanelWindow {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
visible: !ToastService.hasDetails
|
||||
visible: !ToastService.hasDetails && !ToastService.isStickyCategory(ToastService.currentCategory)
|
||||
onClicked: ToastService.hideToast()
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ Singleton {
|
||||
property var lastErrorTime: ({})
|
||||
property int errorThrottleMs: 1000
|
||||
property string currentCategory: ""
|
||||
readonly property var stickyCategories: ["greeter-autologin-sync"]
|
||||
|
||||
function isStickyCategory(category) {
|
||||
return category && stickyCategories.indexOf(category) >= 0
|
||||
}
|
||||
|
||||
function showToast(message, level = levelInfo, details = "", command = "", category = "") {
|
||||
const now = Date.now()
|
||||
@@ -137,7 +142,9 @@ Singleton {
|
||||
toastVisible = true
|
||||
resetToastState()
|
||||
|
||||
if (toast.level === levelError && hasDetails) {
|
||||
if (isStickyCategory(toast.category)) {
|
||||
toastTimer.stop()
|
||||
} else if (toast.level === levelError && hasDetails) {
|
||||
toastTimer.interval = 8000
|
||||
toastTimer.start()
|
||||
} else {
|
||||
@@ -153,6 +160,9 @@ Singleton {
|
||||
}
|
||||
|
||||
function restartTimer() {
|
||||
if (isStickyCategory(currentCategory)) {
|
||||
return
|
||||
}
|
||||
if (hasDetails && currentLevel === levelError) {
|
||||
toastTimer.interval = 8000
|
||||
toastTimer.restart()
|
||||
|
||||
Reference in New Issue
Block a user