To be really productive for my customers I have, over the years, adapted my work setup to my needs. One of the keys of my productivity is the use of wonderful TypeMatrix 2030 keyboard with the Dvorak layout.
The other key is the use of Emacs as text editor. One
peculiarity of Emacs is the extensive use of the Ctrl
key to run
special commands. In a text editor you can save your work with
Ctrl+S
, copy with Ctrl+C
and paste with Ctrl+V
, in Emacs can
do nearly everything with some Ctrl+key
combinations. This requires
an easy to access Ctrl
key and on the TypeMatrix 2030 keyboard,
this means swapping the left shift and the left control keys.
On a modern Linux system with systemd, remapping keys of a USB keyboard is pretty simple, you create a file which simply tell which key code will match which key for which device.
I created the file /etc/udev/hwdb.d/80-typematrix-key.hwdb
with the content:
evdev:input:b*v1E54p2030*
KEYBOARD_KEY_700e0=leftshift # bind left control to left shift
KEYBOARD_KEY_700e1=leftctrl # bind left shift to left ctrl
and run the commands:
sudo udevadm hwdb --update
sudo udevadm trigger
now the two keys are swapped and the changes persist across reboots. If you need, you can learn more about scan codes and key codes. Everything work, I am happy and go back to work. This was just after an upgrade from Ubuntu 14.04 to Ubuntu 16.04 which went without a single glitch. Happy day.
The next day, I run an upgrade of VMWare Workstation as my old version (9) was not compatible with the current Ubuntu version. VMWare Workstation belongs to the software I am happy paying for. They make my work so nice. Because the last thing I want to happen as I work for my customers is the leak of data out of my system as most of the bits I move are covered with non disclosure agreements. This results in a secure by default approach with the rule that I isolate the work for each customer in a dedicated virtual machine.
So, I install the new Workstation, launch a virtual machine, click
around and try to go back to work. End of the day for two days. My
keyboard went totally fubar, enable to use the Ctrl
keys anymore,
both on the left and the right. Of course, as the day before I moved
from xmodmap to the new udev/systemd approach, I first
tried to figure out what was going on on this side of the
system. Without any luck and success, I tried to get logs out of
systemd
and the system messages.
Then by luck, after an afternoon of frustration and a good night, the next day, I found the answer and the issue is coming from the Gnome handling of the capslock key remapping. The solution is extremely simple:
In Gnome Tweak Tool, set "Ctrl key position" to "Caps Lock as Ctrl" and "Caps Lock key behavior" to "Caps Lock is disabled".
Nothing more, nothing less. It works.