I created this script to edit screen brightnes on a macbook.
First you have to install applesmc-dkms:
first add this line:
to your apt sources.list
Code:
nano /etc/apt/sources.list
then install it
Code:
apt-get install applesmc-dkms
now use my script
Code:
#!/bin/bash
# Francesco La Placa (frank10gm@gmail.com)
#
# This program just modifies the value of backlight for Apple Laptops
# You must run it as root user or via sudo.
# As a shortcut you could allow to admin users to run via sudo without password
# prompt. To do this you must add sudoers file the next contents:
#
# Cmnd_Alias CMDS = /usr/local/bin/backlight
# %admin ALL = (ALL) NOPASSWD: CMDS
#
# After this you can use this script as follows:
#
# Increase backlight keyboard:
# $ sudo backlight up
# Decrease backlight keyboard:
# $ sudo backlight down
# Increase to total value backlight keyboard:
# $ sudo backlight total
# Turn off backlight keyboard:
# $ sudo backlight off
#
BACKLIGHT=$(cat /sys/devices/virtual/backlight/apple_backlight/brightness)
MAX=$(cat /sys/devices/virtual/backlight/apple_backlight/max_brightness)
INCREMENT=1
MIN=0
if [ $UID -ne 0 ]; then
echo "Please run this program as superuser"
exit 1
fi
case $1 in
up)
TOTAL=`expr $BACKLIGHT + $INCREMENT`
if [ $TOTAL -eq $MAX ]; then
echo $TOTAL > /sys/devices/virtual/backlight/apple_backlight/brightness
exit 1
fi
if [ $TOTAL -gt $MAX ]; then
let TOTAL=MAX
fi
echo $TOTAL > /sys/devices/virtual/backlight/apple_backlight/brightness
;;
down)
TOTAL=`expr $BACKLIGHT - $INCREMENT`
if [ $TOTAL -eq $MIN ]; then
echo $TOTAL > /sys/devices/virtual/backlight/apple_backlight/brightness
exit 1
fi
if [ $TOTAL -lt $MIN ]; then
let TOTAL=MIN
fi
echo $TOTAL > /sys/devices/virtual/backlight/apple_backlight/brightness
;;
total)
TEMP_VALUE=$BACKLIGHT
while [ $TEMP_VALUE -lt $MAX ]; do
TEMP_VALUE=`expr $TEMP_VALUE + $INCREMENT`
if [ $TEMP_VALUE -gt $MAX ]; then
TEMP_VALUE=$MAX;
fi
echo $TEMP_VALUE > /sys/devices/virtual/backlight/apple_backlight/brightness
done
;;
off)
TEMP_VALUE=$BACKLIGHT
while [ $TEMP_VALUE -gt "0" ]; do
TEMP_VALUE=`expr $TEMP_VALUE - 1`
if [ $TEMP_VALUE -lt "0" ]; then TEMP_VALUE=0; fi
echo $TEMP_VALUE > /sys/devices/virtual/backlight/apple_backlight/brightness
done
;;
*)
echo "Usage: backlight up|down|total|off"
;;
esac
If you want, assign the script to functions keys in system->preferences->keyboard shortcuts (ex: "/script_folder/backlight up" to F5)