mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-30 09:32:05 -04:00
loginctl: simplify event handling
This commit is contained in:
@@ -341,18 +341,6 @@ Singleton {
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
enabled: typeof DMSService !== "undefined" && typeof SessionData !== "undefined"
|
||||
|
||||
function onLoginctlEvent(event) {
|
||||
if (!SessionData.themeModeAutoEnabled)
|
||||
return;
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.loginctlLockIntegration)
|
||||
return;
|
||||
const eventType = String(event?.type || event?.event || "").toLowerCase();
|
||||
if (eventType === "unlock") {
|
||||
root.triggerThemeAutomationRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
function onThemeAutoStateUpdate(data) {
|
||||
if (!SessionData.themeModeAutoEnabled) {
|
||||
@@ -415,7 +403,7 @@ Singleton {
|
||||
|
||||
Connections {
|
||||
target: SessionService
|
||||
enabled: typeof SessionService !== "undefined" && typeof SessionData !== "undefined" && SessionData.themeModeAutoEnabled
|
||||
enabled: SessionData.themeModeAutoEnabled
|
||||
|
||||
function onSessionUnlocked() {
|
||||
root.triggerThemeAutomationRefresh();
|
||||
|
||||
@@ -247,16 +247,16 @@ Item {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
root.recreateOsdSurfaces();
|
||||
root.pendingOsdResumeReloads--;
|
||||
|
||||
if (root.pendingOsdResumeReloads > 1) {
|
||||
root.pendingOsdResumeReloads--;
|
||||
interval = 1400;
|
||||
restart();
|
||||
if (root.pendingOsdResumeReloads <= 0) {
|
||||
root.pendingOsdResumeReloads = 0;
|
||||
interval = 400;
|
||||
return;
|
||||
}
|
||||
|
||||
root.pendingOsdResumeReloads = 0;
|
||||
interval = 400;
|
||||
interval = 1400;
|
||||
restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ Singleton {
|
||||
signal networkStateUpdate(var data)
|
||||
signal cupsStateUpdate(var data)
|
||||
signal loginctlStateUpdate(var data)
|
||||
signal loginctlEvent(var event)
|
||||
signal capabilitiesReceived
|
||||
signal credentialsRequest(var data)
|
||||
signal bluetoothPairingRequest(var data)
|
||||
@@ -348,11 +347,7 @@ Singleton {
|
||||
} else if (service === "network.credentials") {
|
||||
credentialsRequest(data);
|
||||
} else if (service === "loginctl") {
|
||||
if (data.event) {
|
||||
loginctlEvent(data);
|
||||
} else {
|
||||
loginctlStateUpdate(data);
|
||||
}
|
||||
loginctlStateUpdate(data);
|
||||
} else if (service === "bluetooth.pairing") {
|
||||
bluetoothPairingRequest(data);
|
||||
} else if (service === "cups") {
|
||||
|
||||
@@ -749,8 +749,13 @@ Singleton {
|
||||
runResumeRecoveryPass();
|
||||
resumeRecoveryAttempt++;
|
||||
|
||||
if (resumeRecoveryAttempt < 3) {
|
||||
interval = resumeRecoveryAttempt === 1 ? 1400 : 2600;
|
||||
switch (resumeRecoveryAttempt) {
|
||||
case 1:
|
||||
interval = 1400;
|
||||
restart();
|
||||
return;
|
||||
case 2:
|
||||
interval = 2600;
|
||||
restart();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,6 @@ Singleton {
|
||||
}
|
||||
|
||||
function onCapabilitiesReceived() {
|
||||
checkDMSCapabilities();
|
||||
syncSleepInhibitor();
|
||||
}
|
||||
}
|
||||
@@ -526,10 +525,6 @@ Singleton {
|
||||
function onLoginctlStateUpdate(data) {
|
||||
updateLoginctlState(data);
|
||||
}
|
||||
|
||||
function onLoginctlEvent(event) {
|
||||
handleLoginctlEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function checkDMSCapabilities() {
|
||||
@@ -677,16 +672,4 @@ Singleton {
|
||||
|
||||
loginctlStateChanged();
|
||||
}
|
||||
|
||||
function handleLoginctlEvent(event) {
|
||||
if (event.event === "Lock") {
|
||||
locked = true;
|
||||
lockedHint = true;
|
||||
sessionLocked();
|
||||
} else if (event.event === "Unlock") {
|
||||
locked = false;
|
||||
lockedHint = false;
|
||||
sessionUnlocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user