Skip to content

Instantly share code, notes, and snippets.

@voutilad
Created April 27, 2017 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voutilad/fd826ff9e63a5cc9ef08eff9330c989a to your computer and use it in GitHub Desktop.
Save voutilad/fd826ff9e63a5cc9ef08eff9330c989a to your computer and use it in GitHub Desktop.
Backlight brightness control for MacBook Air 11" on Gentoo using Intel driver. (Adapted from https://wiki.gentoo.org/wiki/Apple_Macbook_Pro_Retina_(early_2013)#Display_backlight)
#!/bin/bash
bldb='/sys/class/backlight/intel_backlight/brightness'
step=113
current=`cat $bldb`
new=$current
if [ "$1" == "up" ];then
new=$(($current + $step))
elif [ "$1" == "down" ];then
new=$(($current - $step))
fi
if [ $new -le 0 ];then
new=0
fi
echo $new > $bldb
current=`cat $bldb`
@voutilad
Copy link
Author

Not sure if it's a good idea, but can chgrp wheel that file and and chmod g+w to allow users in wheel group to write to it. Make sure to chmod g+x bl-brightness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment