# Rule for when switching to battery # File: /etc/udev/rules.d/99-on-battery-time.rules # References: # http://www.reactivated.net/writing_udev_rules.html # https://opensourceforu.com/2012/06/some-nifty-udev-rules-and-examples/ # https://superuser.com/questions/1417292/udev-rule-to-start-a-command-on-ac-battery-plug-unplug-event # https://bbs.archlinux.org/viewtopic.php?id=136396 # https://duckduckgo.com/?q=linux+how+long+has+laptop+been+running+on+battery+-life&ia=web SUBSYSTEM!="power_supply", GOTO="onbattery_end" ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/local/bin/onbattery.sh" ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/local/bin/onac.sh" LABEL="onbattery_end"