Created
August 23, 2012 05:38
-
-
Save Apsu/3433066 to your computer and use it in GitHub Desktop.
power_supply udev rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="[01]", RUN+="power %E{POWER_SUPPLY_ONLINE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if (($1)); then # 0 = battery | |
powerup | |
else # 1 = plug | |
powerdown | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The 10-power.rules file goes in /etc/udev/rules.d
The power file goes in /lib/udev/