#!/bin/sh # brightness adjustment script: /etc/brightness/brightness.sh # originally for the MSI X340, but should probably work on most laptops # jwc - http://jwcxz.com bmax=8 # or =`cat /sys/class/backlight/acpi_video0/max_brightness` bmin=0 bound () { if [ "$1" -gt $bmax ]; then return $bmax; fi if [ "$1" -lt $bmin ]; then return $bmin; fi return $1 } bset () { echo $1 > /sys/class/backlight/acpi_video0/brightness echo -n '' bget } badj () { new=`echo $(cat /sys/class/backlight/acpi_video0/brightness) $1 | bc` bound $new bset "$?" } bget () { cat /sys/class/backlight/acpi_video0/brightness; } bup () { badj '+1'; } bdn () { badj '-1'; } blo () { bset $bmin; } bhi () { bset $bmax; } case "$1" in bup|bdn|blo|bhi|bget|bset|badj) $@ ;; "") ;; *) echo "err" ;; esac