From c31dc75c632cc0e4d67de7e81d13f1cb38c52fe2 Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Wed, 10 Sep 2025 00:13:00 +0800 Subject: [PATCH 1/2] Fix: Incorrect 0% battery warning at startup --- Modules/Bar/Widgets/Battery.qml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index bb112e0..5bc8bfa 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -68,14 +68,20 @@ Item { Connections { target: UPower.displayDevice function onPercentageChanged() { - root.maybeNotify(percent, charging) + var currentPercent = UPower.displayDevice.percentage * 100 + var isCharging = UPower.displayDevice.state === UPowerDeviceState.Charging + root.maybeNotify(currentPercent, isCharging) } function onStateChanged() { + var isCharging = UPower.displayDevice.state === UPowerDeviceState.Charging // Reset notification flag when charging starts - if (charging) { + if (isCharging) { root.hasNotifiedLowBattery = false } + // Also re-evaluate maybeNotify, as state might have changed + var currentPercent = UPower.displayDevice.percentage * 100 + root.maybeNotify(currentPercent, isCharging) } } From 5dc4ba504cb2a6e2b9f82897f3c2fc6a7aac2338 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Tue, 9 Sep 2025 18:15:44 +0200 Subject: [PATCH 2/2] PowerProfileService: don't show toast on non valid power profile --- Services/PowerProfileService.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Services/PowerProfileService.qml b/Services/PowerProfileService.qml index 950e4ee..1447227 100644 --- a/Services/PowerProfileService.qml +++ b/Services/PowerProfileService.qml @@ -52,7 +52,11 @@ Singleton { target: powerProfiles function onProfileChanged() { root.profile = powerProfiles.profile - ToastService.showNotice("Power Profile", root.profileName()) + // Only show toast if we have a valid profile name (not "Unknown") + const profileName = root.profileName() + if (profileName !== "Unknown") { + ToastService.showNotice("Power Profile", profileName) + } } } }