aboutsummaryrefslogtreecommitdiff
path: root/99-on-battery-time.rules
diff options
context:
space:
mode:
Diffstat (limited to '99-on-battery-time.rules')
-rw-r--r--99-on-battery-time.rules12
1 files changed, 12 insertions, 0 deletions
diff --git a/99-on-battery-time.rules b/99-on-battery-time.rules
new file mode 100644
index 0000000..0ad6f8d
--- /dev/null
+++ b/99-on-battery-time.rules
@@ -0,0 +1,12 @@
+# 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"
bgstack15