Fix brightness issues on Manjaro

manjaro_compI am using Manjaro LXQt for a while now. My laptop is a Sony VAIO SVS13112ENB with Intel i915 graphics. The brightness keys wouldn’t work out of the box. To fix it I used the same scripts from Ubuntu and attached them to the brightness up/down keys. Those worked but I noticed two more issues with the procedure.

  • After I blank my screen using
    $ xset dpms force off

    my brightness would reset to maximum when the monitor is turns on.

  • While the scripts from the earlier procedure set the brightness level, as reported by
    $cat /sys/class/backlight/intel_backlight/brightness

    the backlight stays at 100 as reported by:

    $ xbacklight

However, both these problems gets fixed if I use xbacklight to set the backlight level. The brightness wouldn’t reset and both backlight and brightness levels would change with different values set by xbacklight. As an additional bonus, it can be run as a regular user.

Another point to notice here is xbacklight actually sets the level at a fractional value, though you pass an integer.

Find the modified scripts using xbacklight below.

br+

#!/bin/bash
#increase monitor brightness

curval=`xbacklight`
curval=${curval%.*}
curval=$(expr $curval + 1)

if [ $curval -ge 50 ]; then
    echo already max
else
    xbacklight -time 1 -set `echo $(expr $curval + 2)`
fi

br-

#!/bin/bash
#decrease monitor brightness

curval=`xbacklight`
curval=${curval%.*}
curval=$(expr $curval + 1)

if [ $curval -le 4 ]; then
    echo already min
else
    xbacklight -time 1 -set `echo $(expr $curval - 2)`
fi

If nothing else works, you can use my patched version of xtrlock. Modify your screen blanking script as:

#!/bin/bash
xset dpms force off
xtrlock -c "xbacklight -set 20" -b

After blanking, the script calls xtrlock to lock your screen. xtrlock sets the backlight to 20 (change it to your preferred value) before exiting.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s