DEV Community

Cover image for Improve workflow efficiency by using your keyboard smarter (Linux)
Nilkun
Nilkun

Posted on

Improve workflow efficiency by using your keyboard smarter (Linux)

64 > 104
I love my keyboard. Although it only has 64 keys, I don't use all of them. So I remapped those keys (and some other as well) to improve my workflow.

Take caps-lock for instance. For me, it is a completely useless key taking up a great spot on the keyboard. Since I'm an avid vim user, I often use escape. So I remapped left-shift + right-shift to caps-lock, and caps-lock to escape.

I use menu to switch between my two most commonly used workspaces, and space-2 (That is my right space bar) is remapped to λ. Why λ? Well, one keypress is better than two, so instead of having to press ctrl-b when using tmux, I just set my prefix key to λ. Efficiency doubled!

How to remap keys in X
In order to remap keys, we first need to find their values. The easiest way is to run xev. In order to simplify this process, you could pipe it to awk like this:

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
Enter fullscreen mode Exit fullscreen mode

The next step is to actually remap the keys. I recommend making a configuration file and then starting it with X. This small sample configuration file changes right-space to λ, and ; to ;(no modkey), + (with Shift), ö (with AltGr), Ö (Shift + AltGr).

!keybindings.conf
keycode 171 = Greek_LAMDA
keycode  47 = semicolon plus odiaeresis Odiaeresis
Enter fullscreen mode Exit fullscreen mode

Then load the configuration file with

xmodmap keybindings.conf

Top comments (8)

Collapse
 
waylonwalker profile image
Waylon Walker • Edited

I am a huge fan of my 60% (vortex pok3r) I have a vimish layer that is always on. I use CAPS as my FN key so I don't even have a caps key on this keyboard. Having arrows, home, end, newline mapped similarly to vim is a game changer for typing everywhere that is not vim.

Since going to 60% I've only had the desire to go even lower and don't like the massive space that a fullsize keyboard takes up when I need to use one. And the fact that I constantly need to look at it to utilize the extra keys if I choose to use them.

The one thing that is nice about the keymap being part of the keyboard is that I switch between three machines of varying OS's quite often, and I get the same typing experience everywhere.

Collapse
 
nilkun profile image
Nilkun

That's really clever! You don't know how many times I've flooded my terminal with "j" and "k"! I will definitely try it out!

As for 60% keyboards, I agree 100%. Smaller is greater.

Collapse
 
waylonwalker profile image
Waylon Walker

I still do that at least 6 times per day. Many times its because my eyes are on the wrong tmux split.

Collapse
 
mafflerbach profile image
mafflerbach

I have a custom keyboard with the qmk firmware. That allows me to program my keyboard. It's a split as well, so one of my thumb keys is maped to esc. I switched the tab and capslock so it's better reachable. Capslock is triggering umlauts. But the rest is a normal US layout.

Collapse
 
nilkun profile image
Nilkun

You just made me remap one of my space keys to escape. Thanks for sharing!

Collapse
 
moopet profile image
Ben Sinclair

If you don't use caps lock, why did you bother making a mapping for it?
I've done the same, btw, using a ~60% keyboard and mapping caps-lock to escape. You can do that natively on Mac, and with xmodmap on Linux, but I used my keyboard's own configuration to do it so it's consistent across systems.
I also mapped the "real" escape key to backtick, because on this keyboard I'd otherwise need to us Fn to get there.

Collapse
 
nilkun profile image
Nilkun

I remapped it "just in case". But you are right. I don't think I've ever used that key combination, and I don't think I ever will.

Collapse
 
oguimbal profile image
Olivier Guimbal

Half of the article is specific to Windows, but you might also be interested in things there :)