From 01ccb771e6d58064cc4209b92aee975254e6de22 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Mon, 25 Aug 2025 13:13:56 +0200 Subject: [PATCH] Possible fix for battery % notification --- Modules/Bar/Widgets/Battery.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index 30fc414..b6823c7 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -19,12 +19,14 @@ Item { // Helper to evaluate and possibly notify function maybeNotify(percent, charging) { const p = Math.round(percent) - if (!charging && p <= 15 && !root.hasNotifiedLowBattery) { + // Only notify exactly at 15%, not at 0% or any other percentage + if (!charging && p === 15 && !root.hasNotifiedLowBattery) { Quickshell.execDetached( ["notify-send", "-u", "critical", "-i", "battery-caution", "Low Battery", `Battery is at ${p}%. Please connect charger.`]) root.hasNotifiedLowBattery = true } - if (p > 20 || charging) { + // Reset when charging starts or when battery recovers above 20% + if (charging || p > 20) { root.hasNotifiedLowBattery = false } }