Gonzalo,

i do this outside of dwm, using, rather, xbindkeys(1).  my .xbindkeysrc
has this
----
# Increase backlight
"myxbacklight -inc 10"
   XF86MonBrightnessUp
# Decrease backlight
"myxbacklight -dec 10"
   XF86MonBrightnessDown
----

and, myxbacklight (which i'm not offering as a model of great
programming!) looks as follows:
----
#!/bin/sh

# does xbacklight, then brags about it

x=$(xbacklight -get | sed s/[.].*//)
if [[ "$1" == "-dec" ]]; then
    if [[ $(($x-$2)) -lt 10 ]]; then
        set -- -set $(($x-1))
    fi
elif [[ "$1" == "-inc" ]]; then
    if [[ $x -lt 10 ]]; then
        set -- -set $(($x+1))
    fi
fi

xbacklight $*


myid=$(dc -e "16 i $(echo $0 | sha1sum 2>&1 | sed 's/\(^.....\).*$/\1/' | tr 
'[:lower:]' '[:upper:]') p")

dunstify --replace=${myid} "Brightness: $(dc -e 3k$(xbacklight)\ .5+0k1/p) 
percent"
----

cheers, Greg

Reply via email to