Skip to content

Instantly share code, notes, and snippets.

@hunner
Created November 2, 2015 18:32
Show Gist options
  • Save hunner/56ce8cb282045611cf66 to your computer and use it in GitHub Desktop.
Save hunner/56ce8cb282045611cf66 to your computer and use it in GitHub Desktop.
xbacklight shell script replacement for gmux (ie, apple macbook pro)
#!/bin/sh
brightness=$(cat /sys/class/backlight/gmux_backlight/brightness)
if [ $1 = '-inc' ] ; then
newbrightness=$(expr $brightness + $2 \* 3)
elif [ $1 = '-dec' ] ; then
newbrightness=$(expr $brightness - $2 \* 3)
fi
if [ $newbrightness -lt 0 ] ; then
newbrightness=0
fi
echo $newbrightness | sudo tee /sys/class/backlight/gmux_backlight/brightness > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment