backlightcontrol
This is an old revision of the document!
I am using fluxbox and wanted to make the brightness-keys work. Here are the 3 scripts I mapped to the brightness keys (~/.fluxbox/keys)
/usr/local/bin/backlight_inc
#!/bin/bash backlight="/sys/class/backlight/pwm-backlight/brightness" current=$(cat $backlight) new=$((current +25)) if [ $new -gt 255 ]; then new=255 fi echo $new > $backlight
/usr/local/bin/backlight_dec
#!/bin/bash backlight="/sys/class/backlight/pwm-backlight/brightness" current=$(cat $backlight) new=$((current - 25)) if [ $new -lt 0 ]; then new=3 fi echo $new > $backlight
/usr/local/bin/backlight_toggle
#!/bin/bash old_file="/tmp/.old_backlight" backlight="/sys/class/backlight/pwm-backlight/brightness" current=$(cat $backlight) if ((current == 0)); then cat $old_file > $backlight else echo $current > $old_file echo 0 > $backlight fi
Finally I had to create a udev-rule to make the whole thing work as a normal user (“normal” as in “in the admin group”): /etc/udev/rules.d/99-backlight-permissions.rules
KERNEL=="pwm-backlight" SUBSYSTEM=="backlight" RUN+="/bin/chmod 664 /sys/class/backlight/pwm-backlight/brightness" KERNEL=="pwm-backlight" SUBSYSTEM=="backlight" RUN+="/bin/chgrp admin /sys/class/backlight/pwm-backlight/brightness"
backlightcontrol.1320496115.txt.gz · Last modified: 2011/11/05 13:28 by excogitation