diff --git a/quickshell/Services/RefreshRateService.qml b/quickshell/Services/RefreshRateService.qml index c122415a8..39e89e726 100644 --- a/quickshell/Services/RefreshRateService.qml +++ b/quickshell/Services/RefreshRateService.qml @@ -14,6 +14,8 @@ Singleton { readonly property int batteryRefreshRateTarget: 60000 readonly property int batteryRefreshRateTolerance: 1000 + property int powerSyncRecoveryAttempt: 0 + readonly property var powerSyncRecoveryIntervals: [1000, 5000, 15000, 30000] property var _lastAppliedTargets: ({}) Timer { @@ -40,6 +42,32 @@ Singleton { onTriggered: root.requestSync("startup") } + Timer { + id: powerSyncRecoveryTimer + interval: root.powerSyncRecoveryIntervals[0] + repeat: false + onTriggered: { + root.requestSync("resume-reconcile"); + root.powerSyncRecoveryAttempt++; + if (root.powerSyncRecoveryAttempt < root.powerSyncRecoveryIntervals.length) { + interval = root.powerSyncRecoveryIntervals[root.powerSyncRecoveryAttempt]; + restart(); + return; + } + root.powerSyncRecoveryAttempt = 0; + interval = root.powerSyncRecoveryIntervals[0]; + } + } + + Connections { + target: SessionService + function onSessionResumed() { + root.powerSyncRecoveryAttempt = 0; + powerSyncRecoveryTimer.interval = root.powerSyncRecoveryIntervals[0]; + powerSyncRecoveryTimer.restart(); + } + } + Connections { target: BatteryService function onIsPluggedInChanged() {