Created
August 4, 2016 23:37
-
-
Save artizirk/707769daeb1c7fc5b9c82ff4d45e1eae to your computer and use it in GitHub Desktop.
Puts my keyboard and mouse to sleep, ie turns off the leds when the screen goes to sleep
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 | |
old_dpms="" | |
while true; do | |
dpms=$(xset -q|grep Monitor|awk '{print $3;}') | |
if [ "$dpms" != "$old_dpms" ]; then | |
old_dpms=$dpms | |
if [ "$dpms" == "Off" ]; then | |
echo "Puting keyboard and mouse to sleep" | |
echo auto | sudo tee /sys/bus/usb/devices/3-13/power/control | |
echo auto | sudo tee /sys/bus/usb/devices/3-14/power/control | |
else | |
echo "Waking keyboard and mouse" | |
echo on | sudo tee /sys/bus/usb/devices/3-13/power/control | |
echo on | sudo tee /sys/bus/usb/devices/3-14/power/control | |
fi | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment