From b3f81f350c28a73f104c3ba6687f8cfe1b560d13 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 5 Nov 2025 10:16:08 +0100 Subject: [PATCH] reduce persistent low battery warnings --- dots/.config/quickshell/ii/services/Battery.qml | 9 ++++++--- dots/.config/quickshell/ii/services/Notifications.qml | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dots/.config/quickshell/ii/services/Battery.qml b/dots/.config/quickshell/ii/services/Battery.qml index b07bd5305..f40087216 100644 --- a/dots/.config/quickshell/ii/services/Battery.qml +++ b/dots/.config/quickshell/ii/services/Battery.qml @@ -38,7 +38,8 @@ Singleton { Translation.tr("Low battery"), Translation.tr("Consider plugging in your device"), "-u", "critical", - "-a", "Shell" + "-a", "Shell", + "--hint=int:transient:1", ]) if (root.soundEnabled) Audio.playSystemSound("dialog-warning"); @@ -51,7 +52,8 @@ Singleton { Translation.tr("Critically low battery"), Translation.tr("Please charge!\nAutomatic suspend triggers at %1%").arg(Config.options.battery.suspend), "-u", "critical", - "-a", "Shell" + "-a", "Shell", + "--hint=int:transient:1", ]); if (root.soundEnabled) Audio.playSystemSound("suspend-error"); @@ -69,7 +71,8 @@ Singleton { "notify-send", Translation.tr("Battery full"), Translation.tr("Please unplug the charger"), - "-a", "Shell" + "-a", "Shell", + "--hint=int:transient:1", ]); if (root.soundEnabled) Audio.playSystemSound("complete"); diff --git a/dots/.config/quickshell/ii/services/Notifications.qml b/dots/.config/quickshell/ii/services/Notifications.qml index 37d72f5b3..702da0f8a 100644 --- a/dots/.config/quickshell/ii/services/Notifications.qml +++ b/dots/.config/quickshell/ii/services/Notifications.qml @@ -25,6 +25,7 @@ Singleton { "text": action.text, })) ?? [] property bool popup: false + property bool isTransient: notification?.hints.transient ?? false property string appIcon: notification?.appIcon ?? "" property string appName: notification?.appName ?? "" property string body: notification?.body ?? "" @@ -63,7 +64,11 @@ Singleton { interval: 7000 running: true onTriggered: () => { - root.timeoutNotification(notificationId); + const index = root.list.findIndex((notif) => notif.notificationId === notificationId); + const notifObject = root.list[index]; + print("[Notifications] Notification timer triggered for ID: " + notificationId + ", transient: " + notifObject?.isTransient); + if (notifObject.isTransient) root.discardNotification(notificationId); + else root.timeoutNotification(notificationId); destroy() } }