At my first internship with Coverfox.com, I received a Lenovo b40 laptop for work. This machine did not have the ThinkPad keyboard but it was up there at ThinkPad levels when it came to typing and generally getting the work done. After leaving Coverfox, I had to switch back to my dell keyboard, which is great but it did leave a lot to be desired. Getting a 2017 MacBook air solved most of my typing issues as I got mine with the scissor switches rather than the butterfly keys on newer pro and air lineup.
I do frequently switch back to the dell laptop for work and I ended up getting a decent 10 keyless keyboard after the onboard keyboard went kaput. The reason why I got this keyboard was the size of the arrow keys was huge. And before getting the apple's keyboard layout registered in my muscle memory, I always had this thing where I needed to have a compact keyboard with full-sized arrow keys. The only caveat with this keyboard was that it doesn't have a full-sized Shift-L key. The layout is a European layout with an extra key to the right of Shift-L that's assigned to less, greater, bar and brokenbar symbols. And that quickly became a problem because there was no way I was getting used to another key that. Which is why I considered remapping the keys on this keyboard.
Remapping on Ubuntu in the past has always been a futile attempt for me as I never ended up finding the right utility that controlled the keyboard layouts and kept it in memory even after a reboot. This was incredibly frustrating given how I was completely reliant on the Shift-L key for most of my typing.
Newer versions of Ubuntu use xkb (X keyboard extension) for keyboard layouts. Each key on the keyboard has an identifier for the system to understand which key is pressed. We use xmodmap utility to find these identifies. Using xmodmap -pke we get the following output. -pke prints the keymap table as expression.
keycode 8 =
keycode 9 = Escape NoSymbol Escape
keycode 10 = 1 exclam 1 exclam
keycode 11 = 2 at 2 at
keycode 12 = 3 numbersign 3 numbersign
keycode 13 = 4 dollar 4 dollar
keycode 14 = 5 percent 5 percent
keycode 15 = 6 asciicircum 6 asciicircum
...
keycode 250 =
keycode 251 =
keycode 252 =
keycode 253 =
keycode 254 = XF86WWAN NoSymbol XF86WWAN
The list that's output to the display is a rather long list and if you have several keys to be remapped, referring it by executing xmodmap -pke multiple times might become a chore. So we can copy the contents to a file for easy reference by running xmodmap -pke > ~/keymaptable
Now that we have the keymap table, we can start modifying the keys to the desired ones. In the terminal, open the xkb file located at /usr/share/X11/xkb/symbols/pcwith sudo priviledges. In my case, I had to set the extra key on the European layout keyboard from its current configuration
// The extra key on many European keyboards: keyto
// The extra key on many European keyboards: keySave and exit vim and clear the xkb settings cache for the remapping to take effect by running sudo rm -rf /var/lib/xkb/* and reboot now commands.
Read more about custom keyboard layouts on Ubuntu's website.