Skip to content

Instantly share code, notes, and snippets.

@gregtaole
Created May 6, 2019 19:01
Show Gist options
  • Save gregtaole/49239bb68da91c92fa2b33e725d1ba80 to your computer and use it in GitHub Desktop.
Save gregtaole/49239bb68da91c92fa2b33e725d1ba80 to your computer and use it in GitHub Desktop.
ACTION=="change", KERNEL=="BAT1", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="[0-9]", \
ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/dinervoid/.Xauthority", \
ENV{DBUS_SESSION_BUS_ADDRESS}="unix:path=/run/user/1000/bus", \
ENV{XUSER}="dinervoid", \
RUN+="/usr/bin/su $env{XUSER} -c '/usr/bin/notify-send -u critical Discharging:$attr{capacity}%'"
ACTION=="change", KERNEL=="BAT1", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="1[0-5]", \
ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/dinervoid/.Xauthority", \
ENV{DBUS_SESSION_BUS_ADDRESS}="unix:path=/run/user/1000/bus", \
ENV{XUSER}="dinervoid", \
RUN+="/usr/bin/su $env{XUSER} -c '/usr/bin/notify-send -u normal Discharging:$attr{capacity}%'"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="0", ENV{POWER}="off", \
ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/dinervoid/.Xauthority", \
ENV{DBUS_SESSION_BUS_ADDRESS}="unix:path=/run/user/1000/bus", \
ENV{XUSER}="dinervoid", \
OPTIONS+="last_rule", \
RUN+="/usr/bin/su $env{XUSER} -c '/usr/bin/notify-send -u low Discharging'"
SUBSYSTEM=="power_supply", ACTION=="change", \
ENV{POWER_SUPPLY_ONLINE}=="1", ENV{POWER}="on", \
ENV{DISPLAY}=":0", ENV{XAUTHORITY}="home/dinervoid/.Xauthority", \
ENV{DBUS_SESSION_BUS_ADDRESS}="unix:path=/run/user/1000/bus", \
ENV{XUSER}="dinervoid", \
OPTIONS+="last_rule", \
RUN+="/usr/bin/su $env{XUSER} -c '/usr/bin/notify-send -u low Charging'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment