Технічно технічний блог

Деякі експеременти, щось з програмування, щось із пізнання та дійсност

18 Nov 2023

Swap permanentally CAPSLOCK with ESC, also in external keyboard

published: November 18, 2023, updated: August 17, 2024; 15:35

Swapping keys ESC and CAPSLOCK

It might be helpful to swap functionality of keys ESC and CAPSLOCK to easily work in word processors like VIM or whatever.

To swap we can use utility like setxkbmap in terminal to swap only for current session

1
setxkbmap -option "caps:swapescape"

setxkbmap sets the keyboard layout for the current X session only, but can be made persistent in xinitrc or xprofile. This overrides system-wide configuration. For example, to achive this, write down the following config to ~/.xinitrc file:

setxkbmap -option caps:escape

To also set up keyboard layout and set keyboard shortcut Alt + Shift to change layout instead write this:

setxkbmap -layout "us,fr,ua,ru" -option "grp:alt_shift_toggle,caps:swapescape"
Next time, we'll talk about "What Tiger King can teach us about x86 Assembly"