Turn Capslock into Control on a Thinkpad X270 running FreeBSD
  =============================================================

Last edited: $Date: 2022/04/09 10:50:47 $

                   FreeBSD 13 on a Thinkpad X270
                   -----------------------------

Recently  I  bought a  refurbished  Thinkpad  X270 with  an  1900x1080
display and installed FreeBSD 13.0 on it.

FreeBSD on the Thinkpad X270 is a great combination.

                         Thinkpad keyboards
                         ------------------

Thinkpads are known to have  great keyboards. And a trackpoint. Typing
on a Thinkpad is great.

But there are some strange design decisions.

Lenovo  puts six-row  keyboards  in Thinkpads,  which  means that  the
Function keys also function as media keys (muting sound, increasing or
decreasing  the sound  volume,  increasing or  decreasing the  display
backlight, and  so on). To  switch between these  two functionalities,
there is a Fn key on the keyboard.

This Fn key is placed left of the  left Ctrl key. So when you are used
to a  the left  most key  on your  keyboard being  the Ctrl  key, your
muscle-memory gets confused.

            Exchange the Fn key and the left Control key

After a couple of days I switched the Fn and the Ctrl key. There is an
option in the Lenovo BIOS for that.

                         No Capslock light
                         -----------------

Lenovo thought it is a good idea to give you no feedback at all on the
state of the Capslock key.

Maybe if you are running Windows on it, there is some kind of software
feedback mechanism, I don't know, because  I have never run Windows on
it.

                          Keyboard Lights

There is a  green LED in the Fn  key, and a red LED in  the mute media
key as well as in the microphone kill media key.

But there is no LED in the Capslock key, only Lenovo knows why.

                           Weird behavior
                           --------------

I  use mostly  keyboard  controlled software,  like  the suckless  dwm
window manager , and Vim and Emacs. So things can suddenly start to go
crazy, when the Capslock is accidentally "on".

This eventually made me decide to ditch the capslock-functionality and
alter the  configuration to  make the Capslock  behave like  a Control
key.

                     Turn Capslock into Control
                     --------------------------

After some searching, I came to this solution.

                             setxkbmap

I have added the following line in my .xinitrc:

   setxkbmap -model thinkpad -layout us -option caps:ctrl_modifier

Now, the  Capslock key  just functions  as an  extra Control  key, and
accidentally touching the Capslock key have no consequences :)