Re: [hackers] [dwm][PATCH] Add keys to control monitor backlight using xbackligh

From: Greg Minshall <minshall_AT_acm.org>
Date: Mon, 13 Apr 2020 16:18:44 -0700

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
Received on Tue Apr 14 2020 - 01:18:44 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 14 2020 - 01:24:35 CEST