Battery Full Notification

hello guys, recently I installed kde plasma, the first thing I wanna do to get notification battery full at certain percent (assume 85%) and my laptop not support charge threshold feature as I read some article. Plasma have “Charge Complete” Notification, this help me so that I don’t forget to unplug. Any help to set that?

This is somewhat dependent on which laptop you have.
Just to check one alternative, can you show the output of command

cat /sys/class/power_supply/BAT*/uevent

I’m so grateful you took the time to respond!

$ cat /sys/class/power_supply/BAT0/uevent 
DEVTYPE=power_supply
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=11211000
POWER_SUPPLY_POWER_NOW=11759000
POWER_SUPPLY_ENERGY_FULL_DESIGN=48400000
POWER_SUPPLY_ENERGY_FULL=41965000
POWER_SUPPLY_ENERGY_NOW=15818000
POWER_SUPPLY_CAPACITY=37
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=K53--52
POWER_SUPPLY_MANUFACTURER=ASUSTek
POWER_SUPPLY_SERIAL_NUMBER= 

If not possible, is there a ‘best away’ to create custom notification? get the current percent cat /sys/classs/power_supply/BAT0/capacity and show a notification.

I have no experience, but on the arch-wiki[1], I found a reference to upower[2].

Perhaps that is useful?

[1] https://wiki.archlinux.org/title/Laptop
[2] https://upower.freedesktop.org/

1 Like

Yeah, that is what many of the minimal window managers do with small scripts.

You may want to look at these packages:
https://archlinux.org/packages/extra/x86_64/acpi/
https://archlinux.org/packages/extra/x86_64/libnotify/

Then create a bash shell script that loops, pulling the battery level, comparing if the value is above/below a particular level, then send-notify to create a notification.

You can probably find some scripts in open dotfile collections on github related to dwm, spectrwm, etc.

1 Like

I’ve made a small, experimental charging notifier app for my personal use, maybe you’d like to try it?

You can download it here:
https://github.com/manuel-192/m-m/raw/refs/heads/master/repo/charge-notifier-24.11-1-any.pkg.tar.zst

But you should try it only if you trust its creator. :wink:

If you try it, you need to configure it according to your system. To do so, run

battnot --edit-config

and at least slightly change the line starting with the --power-device-info option (BAT1 -> BAT0).

2 Likes

This is exactly what I want to do, and it’s the perfect solution for me. Thank you SIR! :fist_right:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.