mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-30 17:42:06 -04:00
fix(quickshell): restore night mode and OSD surfaces after resume (#2254)
This commit is contained in:
committed by
GitHub
parent
c6ed64b24e
commit
b87c36d29e
@@ -40,6 +40,7 @@ Singleton {
|
||||
property bool nightModeEnabled: false
|
||||
property bool automationAvailable: false
|
||||
property bool gammaControlAvailable: false
|
||||
property int resumeRecoveryAttempt: 0
|
||||
|
||||
property var gammaState: ({})
|
||||
property int gammaCurrentTemp: gammaState?.currentTemp ?? 0
|
||||
@@ -672,6 +673,15 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function runResumeRecoveryPass() {
|
||||
checkGammaControlAvailability();
|
||||
rescanDevices();
|
||||
|
||||
if (nightModeEnabled) {
|
||||
evaluateNightMode();
|
||||
}
|
||||
}
|
||||
|
||||
function checkGammaControlAvailability() {
|
||||
if (!DMSService.isConnected) {
|
||||
return;
|
||||
@@ -730,6 +740,26 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: resumeRecoveryTimer
|
||||
interval: 400
|
||||
repeat: false
|
||||
|
||||
onTriggered: {
|
||||
runResumeRecoveryPass();
|
||||
resumeRecoveryAttempt++;
|
||||
|
||||
if (resumeRecoveryAttempt < 3) {
|
||||
interval = resumeRecoveryAttempt === 1 ? 1400 : 2600;
|
||||
restart();
|
||||
return;
|
||||
}
|
||||
|
||||
resumeRecoveryAttempt = 0;
|
||||
interval = 400;
|
||||
}
|
||||
}
|
||||
|
||||
function rescanDevices() {
|
||||
if (!DMSService.isConnected) {
|
||||
return;
|
||||
@@ -815,19 +845,23 @@ Singleton {
|
||||
updateSingleDevice(device);
|
||||
}
|
||||
|
||||
function onLoginctlEvent(event) {
|
||||
if (event.event === "unlock" || event.event === "resume") {
|
||||
suppressOsd = true;
|
||||
osdSuppressTimer.restart();
|
||||
evaluateNightMode();
|
||||
}
|
||||
}
|
||||
|
||||
function onGammaStateUpdate(data) {
|
||||
root.gammaState = data;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SessionService
|
||||
|
||||
function onSessionResumed() {
|
||||
suppressOsd = true;
|
||||
osdSuppressTimer.restart();
|
||||
resumeRecoveryAttempt = 0;
|
||||
resumeRecoveryTimer.interval = 400;
|
||||
resumeRecoveryTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
// Session Data Connections
|
||||
Connections {
|
||||
target: SessionData
|
||||
|
||||
Reference in New Issue
Block a user