8

I'm trying to set custom screen bindings in i3WM and looking for a way to decrease/increase the brightness on button press. I've tried using the following:

xbacklight -dec10
xbacklight -set 70

xbacklight would work however it does not affect my HDMI connected monitor, no backlight apparently:

xrandr --verbose

HDMI-0 has no "Backlight" property unlike the laptop screen, the above code works fine on my laptop screen, however I want to reduce the brightness on all monitors.

Next I tried:

xrandr --output DP-0 --brightness 0.5
xrandr --output HMDI-0 --brightness 0.5

Which works! Well, for about 1 second then it defaults back. My question: is there any way I can get these changes to stick, at least until the next reboot?

PS - Running Debian GNU/Linux 8.5 | 4.5.0-0.bpo.1-amd64 | i3 4.8-2

PPS - I can easily set the i3 configuration and key bindings, no assistance needed with that part :)

0

You can use the following script found on doc.ubuntu-fr.org(based on xbacklight tool):

Create a new configuration file brightness under /usr/local/bin with the following contents:

#!/bin/bash

error="Usage: $0 up | $0 down"
xbl=`xbacklight`
limite1=2
limite2=10
limite3=40
limite4=100

if [ "$#" -eq 1 ]
    then
    if [ $1 = "up" ]
        then
        # Augmenter le rétroéclairage
        if [ $(echo "$xbl == $limite4"|bc) -eq 1 ]
                then
                echo "Rétroéclairage au maximum !"
                xbacklight = 100
            else
            if [ $(echo "$xbl < $limite2"|bc) -eq 1 ]
                    then
                    xbacklight +1
                 else
                if [ $(echo "$xbl < $limite3"|bc) -eq 1 ]
                        then
                        xbacklight +10
                    else
                    xbacklight +20
                fi
            fi
        fi
    elif [ $1 = "down" ]
        then
        # Diminuer le rétroéclairage
        if [ $(echo "$xbl < $limite1"|bc) -eq 1 ]
                then
                echo "Rétroéclairage au minimum !"
                xbacklight =1
            else
            if [ $(echo "$xbl < $limite2"|bc) -eq 1 ]
                    then
                    xbacklight -1
                else  
                if [ $(echo "$xbl < $limite3"|bc) -eq 1 ]
                        then
                        xbacklight -10
                    else
                    xbacklight -20
                fi
            fi
        fi
        else
        echo $error
    fi
    else
    echo $error
fi
exit

Make it executable:

sudo chmod +x /usr/local/bin/brightness

To increase the brightness , open the terminal and type:

brightness up

To decrease the brightness ,type:

brightness down
  • 1
    Couple of things, firstly, I get a permission denied when trying to run the brightness up/down command. I've made it executable, tried changing the owner to my user and moving the script to another location. No luck. Second, I'm not sure this will fix the problem I'm having, my second screen has no backlight property so the xbacklight tool will not work, I don't think – tuxedozombie Jul 24 '16 at 20:06
  • You should install the graphic driver first . what is the output of lspci | grep 'vga' and glxinfo | grep "OpenGL vendor string" ? – GAD3R Jul 25 '16 at 8:35
0

Are you using redshift?

I had your exact same issue and it was resolved by killing redshift.

killall redshift

xrandr --output HDMI-0 --brightness .5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.