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

From: Gonzalo Fernández <fernandez.gfg_AT_gmail.com>
Date: Mon, 13 Apr 2020 21:22:36 -0300

Greg,

I didn't know about xbindkeys. I'm new with suckless tools, I'm working on
my dwm setup (st and dmenu too) and I didn't know the best way to do it.
Considering the suckless philosophy, is the way you tell me better than a
dwm patch? Or would you say it's just a different way of making it work?
Because I still haven't solved it for the volume control keys.

Thanks for comment!

Gonzalo


On Mon, Apr 13, 2020 at 4:41 PM Greg Minshall <minshall_AT_umich.edu> wrote:

> 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
>


-- 
Gonzalo Gabriel Fernández
Received on Tue Apr 14 2020 - 02:22:36 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 14 2020 - 19:00:36 CEST