forked from Ventto/batify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path99-batify.rules
More file actions
21 lines (18 loc) · 1.3 KB
/
99-batify.rules
File metadata and controls
21 lines (18 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ACTION=="change", KERNEL=="BAT[0-9]", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="[0-9]", \
RUN+="/usr/bin/su -c 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${ID}/bus /usr/bin/notify-send -u critical -i battery-empty \"Battery $kernel status\" \"Battery $kernel level is CRITICAL at $attr{capacity}%\"' ${USER}"
ACTION=="change", KERNEL=="BAT[0-9]", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="1[0-9]", \
RUN+="/usr/bin/su -c 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${ID}/bus /usr/bin/notify-send -u normal -i battery-caution \"Battery $kernel status\" \"Battery $kernel level is getting low at $attr{capacity}%\"' ${USER}"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="0", ENV{POWER}="off", \
OPTIONS+="last_rule", \
RUN+="/usr/bin/su -c 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${ID}/bus /usr/bin/notify-send -u low -i battery-missing \"Power status\" \"Charging cable has been unplugged.\"' ${USER}"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="1", ENV{POWER}="on", \
OPTIONS+="last_rule", \
RUN+="/usr/bin/su -c 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${ID}/bus /usr/bin/notify-send -u low -i battery-full-charging \"Power status\" \"Charging cable is now plugged.\"' ${USER}"