# for a udev rule file
# Send notification when battery is low
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[15-6]", RUN+="/path/to/battery-warning.sh"
# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/usr/bin/systemctl suspend"
And the script battery-warning.sh could be sth like;
From: https://niekvanleeuwen.nl/2020/04/making-arch-linux-i3-wm-usable/#battery-notifications
And the script
battery-warning.sh
could be sth like;