Power Management: Battery Low notification can't be closed

Hi all,
I just received the Battery Low notification when the battery reached 10% charge. I connected the power and the battery was charging. The pop-up stayed in place, it did not close automatically, but I know some don’t do that. After I saw the percentage of charge in the battery was rising I clicked the X button in the pop-up but nothing happened, I can’t close the pop-up.

The battery is now at 31% but still I see the pop-up. Is there something I can do about it, something else than report it?

$ f
             .',;::::;,'.                 jan@toolbx
         .';:cccccccccccc:;,.             ----------
      .;cccccccccccccccccccccc;.          OS: Fedora Linux 45 (Toolbx Container Image Prerelease) x86_64
    .:cccccccccccccccccccccccccc:.        Host: 82RG (Legion 5 Pro 16ARH7H)
  .;ccccccccccccc;.:dddl:.;ccccccc;.      Kernel: Linux 7.2.5-300.fc45.x86_64
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.     Uptime: 4 hours, 40 mins
.:ccccccccccccc;KMMc;cc;xMMc;ccccccc:.    Packages: 7 (flatpak-system), 45 (flatpak-user), 761 (rpm)
,cccccccccccccc;MMM.;cc;;WW:;cccccccc,    Shell: conmon
:cccccccccccccc;MMM.;cccccccccccccccc:    Display (BOE0A9B): 2560x1600 @ 1.09x in 16", 165 Hz [Built-in] *
:ccccccc;oxOOOo;MMM000k.;cccccccccccc:    Display (27M1C5500V): 2560x1440 in 27", 120 Hz [External]
cccccc;0MMKxdd:;MMMkddc.;cccccccccccc;    Desktop Environment: KDE Plasma
ccccc;XMO';cccc;MMM.;cccccccccccccccc'    Window Manager: KWin (Wayland)
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;     WM Theme: Breeze
ccccc;0MNc.ccc.xMMd;ccccccccccccccc;      Theme: Breeze (Light) [Qt], Breeze-Dark [GTK2], Breeze [GTK3]
cccccc;dNMWXXXWM0:;cccccccccccccc:,       Icons: Infinity-Dark-Icons [Qt], Infinity-Dark-Icons [GTK2/3/4]
cccccccc;.:odl:.;cccccccccccccc:,.        Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4]
ccccccccccccccccccccccccccccc:'.          Cursor: Breeze_Light (24px)
:ccccccccccccccccccccccc:;,..             Terminal: konsole 26.8.1
 ':cccccccccccccccc::;,.                  CPU: AMD Ryzen 7 6800H (16) @ 4.79 GHz
                                          GPU 1: NVIDIA GeForce RTX 3060 Mobile / Max-Q [Discrete]
                                          GPU 2: AMD Radeon 680M [Integrated]
                                          Memory: 5.10 GiB / 14.80 GiB (34%)
                                          Swap: 0 B / 8.00 GiB (0%)
                                          Disk (/): 606.69 GiB / 903.86 GiB (67%) - overlay
                                          Disk (/run/host/boot): 518.18 MiB / 1.90 GiB (27%) - ext4
                                          Disk (/run/host/boot/efi): 45.16 MiB / 510.98 MiB (9%) - vfat
                                          Disk (/run/host/etc): 17.09 GiB / 31.20 GiB (55%) - ext4
                                          Disk (/run/host/var/home): 606.69 GiB / 903.86 GiB (67%) - ext4
                                          Local IP (tun0): 10.100.0.2/21
                                          Battery (L21C4PC1): 72% [Discharging]
                                          Locale: en_US.UTF-8

Dose this help:

/usr/bin/bash -c 'sleep 0.5; i="$(( $(notify-send -p " " -t 1) - 1 ))" && sleep 4.5 && qdbus org.kde.plasmashell /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification $i'

That should close it in 5 seconds.

By default, KDE Plasma does not allow the “Battery Low” notification to disappear automatically after a few seconds; it remains persistent until manually dismissed or until the device is plugged into a power source. And Sometimes just sticks…:frowning:

Assuming that no other notification has appeared since the low battery one, right?

fastfetch -l none skips the logo so that we don’t have to scroll right past the ASCII art :grinning_face:

This is a bit surprising because Plasma made a change a while ago so that the notification should disappear as soon as you plug in your charger.

That was back in Plasma 5 so I don’t know if something got lost on the way to Plasma 6. Worth asking KDE and/or making a bug report.

Right! :wink: Nice addtion @pg-tips

Hi Rick, this is what I get:

$ /usr/bin/bash -c 'sleep 0.5; i="$(( $(notify-send -p " " -t 1) - 1 ))" && sleep 4.5 && qdbus org.kde.plasmashell /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification $i'
/usr/bin/bash: line 1: qdbus: command not found

Can it be replaced by a command which Kinoite does know?

You could replace the qdbus part of the command with:

notify-send -r $i -t 1 ""

That should modify the notification to a blank message that disappears in 1 millisecond.

(I think qdbus6 may be available, but the notify-send approach is a bit more concise. The notify-send command is basically a convenient wrapper around the DBus method calls.)

Sorry, but this also doesn’t do it. I see the pop-up jump up and down a little and then nothing. It’s still visible.

Can you show us the comand used?

This is what I used lastL

/usr/bin/bash -c 'sleep 0.5; i="$(( $(notify-send -p " " -t 1) - 1 ))" && sleep 4.5 && notify-send -r $i -t 1 "" '

Before that I used this as a replacement for the original code:

/usr/bin/bash -c 'sleep 0.5; i="$(( $(notify-send -p " " -t 1) - 1 ))" && sleep 4.5 && qdbus org.kde.plasmashell /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification $i'

Both did nothing.

I see you need to replace all qdbus ie:

 /usr/bin/bash -c 'sleep 0.5; i="$(( $(notify-send -p " " -t 1) - 1 ))" && sleep 4.5 && notify-send -p  org.kde.plasmashell /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification $i'

I tested this on my setup, and it does succesfully kill the last-sent notification after 4.5s.

It does, as we said, make the assumption that the low battery notification is the last thing that was sent.

Another factor is: maybe Plasma just resurrects the low battery notification if you kill it, in which case this approach won’t help much.

I totally missed the second dbus command, I did not see it.
I can’t test it now since I did a restart which also killed the notification, but I wrote it in my Kinoite document so should it happen again I can use it.
Thank you, and thank you P G, for your help.