Skip to content

Instantly share code, notes, and snippets.

@userid
Created September 8, 2016 08:53
Show Gist options
  • Select an option

  • Save userid/127f980962e88d75d3fa3e8c45e64c73 to your computer and use it in GitHub Desktop.

Select an option

Save userid/127f980962e88d75d3fa3e8c45e64c73 to your computer and use it in GitHub Desktop.
/etc/acpi/asus-keyboard-backlight.sh
#!/bin/sh
# this directory is a symlink on my machine:
KEYS_DIR=/sys/class/leds/asus\:\:kbd_backlight
test -d $KEYS_DIR || exit 0
MIN=0
MAX=$(cat $KEYS_DIR/max_brightness)
VAL=$(cat $KEYS_DIR/brightness)
if [ "$1" = down ]; then
VAL=$((VAL-1))
else
VAL=$((VAL+1))
fi
if [ "$VAL" -lt $MIN ]; then
VAL=$MIN
elif [ "$VAL" -gt $MAX ]; then
VAL=$MAX
fi
echo $VAL > $KEYS_DIR/brightness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment