>> x220t - Get the Fn-keys work


EDIT:Repaired the link to the sxhkd.zip.


Functionkeys of laptops under Linux

After the sucessful install of Arch on the x220t I wasn't suprised to see that most of the Fn-keys didn't work. If you read this you should know that the driver support for Linux isn't existing the way it does for Windows. Under Windows the Fn-keys work "by default", if you install the correct driver/fancy-thinkpad-utility.

For those who can't wait, here is a table for all Fn-buttons and how I made them work or not.

What I tried first.

At first I tried a listen for ACPI events. But not all keys cause such an event. ACPI-Events are signales send from special hardware parts.The ACPI-kernelnmodule can listen for this events and you can "connect" scripts or other things with the the ACPI-event. For my thinkpad I used the thinkpad_acpi module. If you want you can get a lot of Fn-keys work this way but not all.

How did I got it work?

The better way is to listen for keysyms. Every key (or Fn-keys) send its own unique code. What I did is, set up a service who listen for keysyms, grabbs them and launches a script. This service is sxhkd a light program which you can get on github. In my case I cloned it to

git clone https://github.com/baskerville/sxhkd.git ~/github/sxhkd

NOTE: Until now I don't maintain this scripts. Some updates can break them. I will try to upload a fixed version if I got time. If you fixed a script I would be happy if you send it to me! Some scripts include German comments I will try to translate this asap.

Set sxhkd up.

In the next step download this downloadable .zip. It includes my scripts and sxhkd_config, some actions are directly in the sxhkd_config. Unzip and place the included folder "sxhkd" in your home directory or whereever you want. If you use an other path you need to over work the sxhkd_config or make a symbolic link. Otherwise you can look in this article for single scripts.

cd ~
ln -s /your/path/to/the/unzipped/folder ./

Feel free to comment or uncomment the keys from the config you don't want to use. As last step you maybe want to make sxhkd autostart with the correct config you just downloaded. You can achiev this by adding this line to your xinitrc. It should look like this:


# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 unset f

#custom autostart
#& starts stuff in background
sxhkd -c ~/sxhkd/sxhkd_config &

exec startxfce4

There is a table in my blog which shows what buttons are working and which not. And if you need script or it works by default.