Notification for battery levels #1

Open
opened 2022-03-25 02:26:53 +00:00 by james · 0 comments
Owner

This udev rule set was from my old machine. using something like this would be good.

ACTION=="change", KERNEL=="BAT0", \
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 Discharging:$attr{capacity}%'"

ACTION=="change", KERNEL=="BAT0", \
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 Discharging:$attr{capacity}%'"

ACTION=="change", KERNEL=="BAT0", \
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", \
ATTR{capacity}=="[2-9][0-9]", \
IMPORT{program}="/usr/bin/xpub", \
RUN+="/bin/su $env{XUSER} -c 'notify-send -u normal Discharging:$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 \" Power Disconnected\" \"Battery at $(cat /sys/class/power_supply/BAT0/capacity)%\" '"

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 \" Power Connected\" \"Battery at $(cat /sys/class/power_supply/BAT0/capacity)%\" '"
This udev rule set was from my old machine. using something like this would be good. ``` ACTION=="change", KERNEL=="BAT0", \ 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 Discharging:$attr{capacity}%'" ACTION=="change", KERNEL=="BAT0", \ 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 Discharging:$attr{capacity}%'" ACTION=="change", KERNEL=="BAT0", \ SUBSYSTEM=="power_supply", \ ATTR{status}=="Discharging", \ ATTR{capacity}=="[2-9][0-9]", \ IMPORT{program}="/usr/bin/xpub", \ RUN+="/bin/su $env{XUSER} -c 'notify-send -u normal Discharging:$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 \" Power Disconnected\" \"Battery at $(cat /sys/class/power_supply/BAT0/capacity)%\" '" 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 \" Power Connected\" \"Battery at $(cat /sys/class/power_supply/BAT0/capacity)%\" '" ```
This repo is archived. You cannot comment on issues.
No Label
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: james/nil#1
No description provided.