From 8fedfae1dc99d638080d907bcc51965cc45ba9d0 Mon Sep 17 00:00:00 2001 From: Artem Timofeev <39891735+atimofeev@users.noreply.github.com> Date: Wed, 7 Oct 2026 17:17:12 +0200 Subject: [PATCH] fix(power): reconcile refresh rate after resume (#3459) --- quickshell/Services/RefreshRateService.qml | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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() {