Set backlight brightness on boot on a ThinkPad T440s runing on Arch

1

I recently bought a new Lenovo ThinkPad T440s laptop and installed Arch Linux on it. Most things worked out of the box. One minor problem, among few others, is with the backlight brightness.

I can adjust brightness via the Fn+F5 and Fn+F6, but on reboot brightness is back to 100%. This starts to burn your eyes out after a while, so I reduce the it manually to about 50% to 60%. Can I automate this somehow, while preserving Fn-key functionality? The wiki articel in ArchWiki talks about using either systemd, udev or acpid, but does not get anymore specific about advantages, drawbacks or even how to do it. Which is the method to go for?

Edit1 06.09.14: I use GNOME3 as DE

Greetings paradoxon

paradoxon

Posted 2014-09-06T12:34:39.543

Reputation: 596

Answers

1

You can use xrandr, it works nice even for multiple monitors connected. I don't know which desktop environment you use so I can't be specific. Here is the script you can use after boot:

#!/bin/bash

YOUR_BRIGHTNESS_PREFERENCE=0.6
for DISP in `xrandr -q | grep " connected" | cut -d ' ' -f1`; do
  xrandr --output "$DISP" --brightness "$YOUR_BRIGHTNESS_PREFERENCE"
done

It changes backlight brightness on all connected monitors to 60%.

ioku

Posted 2014-09-06T12:34:39.543

Reputation: 21

On my T410, this changes gamma, not brightness. They are not the same thing. – Laszlo Valko – 2014-09-06T22:36:13.737

I can confirm this. It does not change brightness, it changes gamma, what results in a change of brighness in the displayed image but not in backlight brightness. – paradoxon – 2014-09-07T12:08:42.207

Sorry, I didn't know there was difference. How about using redshift? It changes your screen color temperature during the day so your eyes don't hurt. Also you can set up your prefered brightness and additionally correct gamma. – ioku – 2014-09-07T15:35:39.227

0

I figured out a workaround... oke it's more sort of a hackaround :P

I created a systemd service which fires of a script that sets the brightness level once on startup. Technicaly the service systemd-backlight@backlight:intel_backlight should take care of saving and setting the backlight levels on shutdown/startup, but this seems to be broken at the moment. According to some recent archlinux forum posts there has been quite a deal of hacking going on in the kernel code handling this.

Here are the two files i created

/usr/lib/systemd/scripts/set_brithness (remember to make this executable with chmod 750

#!/bin/bash

echo "250" > /sys/class/backlight/intel_backlight/brightness

And

/usr/lib/systemd/system/set_brithness

[Unit]
Description= Set brightness to a reasonable level on start-up, since systemd backlight@backlicht:intel_backlight is broken for the moment.

[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/scripts/set_brightness

[Install]
WantedBy=multi-user.target

I have ttested​it with a simple reboot but do not know how it behaves on hibernate/suspend. Also, this​as a little glitch Gonme Settings do not keep​ttrack​of this change. If you open monitor cconfiguration it ​will set bthe​brightness​to the last value it knew about. Same thing with Functionkeys. But I can live with this for now. I will also hit the Arch Forums with this, to further investigate this and maybe file a bug.

paradoxon

Posted 2014-09-06T12:34:39.543

Reputation: 596