-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path99-batify.rules
25 lines (22 loc) · 1.15 KB
/
99-batify.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ACTION=="change", KERNEL=="BAT[0-9]", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="[0-9]", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u critical -i battery-empty \"Battery status\" \"Battery level is CRITICAL at $attr{capacity}%\"'"
ACTION=="change", KERNEL=="BAT[0-9]", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="1[0-9]", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u normal -i battery-caution \"Battery status\" \"Battery is getting low at $attr{capacity}%\"'"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="0", ENV{POWER}="off", \
OPTIONS+="last_rule", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u low -i battery-missing \"Battery status\" \"Charging cable has been unplugged.\"'"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="1", ENV{POWER}="on", \
OPTIONS+="last_rule", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u low -i battery-full-charging \"Battery status\" \"Charging cable is now plugged.\"'"