mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Possible fix for battery % notification
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user