Created
August 22, 2014 06:21
-
-
Save jzuijlek/8fb0515cbbc8a6638cbc to your computer and use it in GitHub Desktop.
Asus backlight/backlit keyboard suspend/resume
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 | |
## /etc/pm/sleep.d/80_asus-kbd-backlight | |
BRIGHTNESS_FILE="/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness" | |
BRIGHTNESS_BAK_FILE="/var/lib/asus-kbd-backlight/brightness" | |
DEFAULT=1 | |
case "$1" in | |
thaw|resume) | |
if [ -f "$BRIGHTNESS_BAK_FILE" ] ; then { | |
#Restores the last value | |
cat "$BRIGHTNESS_BAK_FILE" > "$BRIGHTNESS_FILE" | |
} else { | |
#Sets the default value | |
echo "$DEFAULT" > "$BRIGHTNESS_FILE" | |
} fi | |
;; | |
hibernate|suspend) | |
#Turn of the backlight | |
echo 0 > "$BRIGHTNESS_FILE" | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment