2 # A very primitive backlight setter with a hardcoded backlight path, to replace
3 # xbacklight which currently does not work on my system.
4 if ! echo "${1}" | egrep -q '^[0-9]+$'; then
5 echo 'Argument must be a number.'
9 backlight_dir=/sys/class/backlight/intel_backlight
10 max_brightness=$(cat "${backlight_dir}"/max_brightness)
11 if [ "${percentage}" = '100' ]; then
12 sudo sh -c 'echo '"${max_brightness}"' > '"${backlight_dir}"'/brightness'
14 fract=$(expr "${max_brightness}" / 100)
15 brightness=$(expr "${percentage}" \* "${fract}")
16 sudo sh -c 'echo '"${brightness}"' > '"${backlight_dir}"'/brightness'