I got a new laptop for work, Lenovo Thinkpad X260. Installed Ubuntu 16.04 Xenial Xerus without much problem.
There are several Fn-hotkeys for the F1-F12 keys, most of them do not work out of the box in Ubuntu, at least not when running i3-window manager.
I managed to solve it in the end. This is how. Part of this solution is from
Thanks for that!
Changing the brightnessI figured out that the brightness can be changed with
$ sudo echo VALUE > /sys/class/backlight/intel_backlight/brightness
where VALUE is between 0 and what is given by the output
$ cat /sys/class/backlight/intel_backlight/max_brightness
These paths might be different for you, so you have to figure it out, and edit the paths in the script below to fit your needs.
The scriptSo I created a script that changes the brightness, as mentioned it borrows heavily from the above mentioned page, but there are some changes.
I save it as brightness_control in some place, perhaps in your bin folder or something.
The script is as follows:
# script to control the brightness of a Lenovo Thinkpad X260
# in i3wm (Ubuntu Linux)
# Magnus Persson, with help from
# how much we change the brightness is the input parameter
# get the maximum brightness value
# get the current brightness
# calculate the new value that is requested.
# if input is negative it will subtract (?)
new_value=$(($brightness + $change))
# if the new value is less than 1, we just set it to 1
# 0 is completely pitch black, just put pc to sleep
# if you want that.
if (( $new_value < 10 )); then
# if the new value is greater than max brightness, set it to max brightness
elif (($new_value > $max_brightness)); then
# if none of the above if-statements are true, just set it to the
# new brightness value
# now we can just echo the value into the brightness acpi(?) file
echo $brightness > /sys/class/backlight/intel_backlight/brightness #| bash #or zsh, csh or whateva
$ sudo visudo
and add, to the end of the file
your_user your_machine = NOPASSWD: /path/to/brightness_control
(i.e. $ sudo ./brightness_control -400, to lower the brightness 400 units )
Give your file to root
i3 window manager
Now I have in my $HOME/.config/i3/config file