Why do I need to customize the keyboard?
You can use the standard settings, but sometimes the changes make it possible to type faster (this, of course, is not a blind print, but still), make fewer errors, switch the layout less ...
Why did I want to change my keyboard?
Firstly, when I started using it vim
as the main editor, I realized that I didnโt want to reach for each time ESC
. In addition, I wrote mainly in python, so I ;
pressed much less often than :
, and the vim
difference became more pronounced.
Secondly, after a while I began to use Vimov combinations for navigating in the browser, then the tile window manager i3
, where they were also used, and I wanted to switch to them everywhere (instead of the usual arrows, for example, in the file manager).
Thirdly, when I began to write notes on TeX
in vim
, I realized that I could really simplify and speed up this process; if the English and Russian layouts are more similar to each other, then I can enter the same characters (for example, period, comma, quotation marks, dollar) the same way. Plus, you often have to change the language, so you need to do this quickly, reliably and conveniently.
Layout Switch Setting
Well, let's begin. First, let's figure out how you can configure a keyboard layout change.
The first way. You can use some program, for example gnome-tweaks
:
here we can choose one of the options offered by developers.

The main thing is that we cannot create our own version. Let's learn to do that too.
.
, , .
Alt
( AltGr
):
$ setxkbmap -layout us,ru -option grp:toggle
, , ? /usr/share/X11/xkb/symbols/
. /usr/share/X11/xkb/symbols/group
. :
partial modifier_keys
xkb_symbols "toggle" {
virtual_modifiers AltGr;
key <RALT> {
symbols[Group1] = [ ISO_Next_Group ],
virtualMods = AltGr
};
};
, , , , , .
AltGr
: AltGr
, Shift+AltGr
โ .
- , :
$ setxkbmap -layout us,ru -print
- (pc105
):
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+ru:2+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
~/.config/xkb/config
.
/usr/share/X11/xkb/symbols/group
CapsLock
, , us
ISO_First_Group
, ru
โ ISO_Second_Group
.
key <CAPS> { [ ISO_First_Group, ISO_Last_Group ] };
, <CAPS>
ISO_First_Group
, Shift
โ ISO_Last_Group
.
xkb_symbols
:
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_geometry { include "pc(pc105)" };
xkb_symbols "my" {
include "pc+us+ru:2+inet(evdev)"
key <RALT> { [ ISO_First_Group, ISO_Last_Group ] };
};
};
, . :
$ xkbcomp $HOME/.config/xkb/config $DISPLAY
.
, , (, TeX
), , , , , , . , .
โ .
. , . /usr/share/X11/xkb/symbols/
. us
:
key <AC10> { [ semicolon, colon ] };
.
ESC
CapsLock
ESC
CapsLock
. capslock
:
hidden partial modifier_keys
xkb_symbols "swapescape" {
key <CAPS> { [ Escape ] };
key <ESC> { [ Caps_Lock ] };
};
hidden partial modifier_keys
xkb_symbols "escape" {
key <CAPS> { [ Escape ] };
};
partical
โ , .
include "swapescape"
, .
Alt
Win
, , Alt
Win
, i3wm
, Win
, , Alt
(, ...).
? , - - , , .
: level3
, level5
. Shift
.
, CapsLock
h, j, k, l . .
( ESC
, : ):
key <CAPS> { [ ISO_Level3_Shift ] };
, :
name[group1] = "English (US)";
name[group2] = "Russian";
key <CAPS> {
symbols[group1] = [ ISO_Level3_Shift ],
symbols[group2] = [ Caps_Lock ]
}
h, j, k, l. โ , . <AC06>
,โฆ <AC09>
. . :
key <AC06> { [ h, H, KP_Left ] };
key <AC07> { [ j, J, KP_Down ] };
key <AC08> { [ k, K, KP_Up ] };
key <AC09> { [ l, L, KP_Right ] };
, โ , โ .
.
, CapsLock
โ ESC
.
xcape
, , , . : , .
, , CapsLock
ESC
, .
$ xcape -t < > -e " = "
500 . :
$ xcape -t 500 -e "ISO_Level3_Shift=Escape"
TeX
, , . . , , , , , ...
:
.
:
( /, , , ):
key <AD03> {
type = "ALPHABETIC",
type[group2] = "FOUR_LEVEL",
symbols[group2] = [Cyrillic_u, Cyrillic_U, Cyrillic_yu, Cyrillic_YU]
};
, .
, ( ), , . .
: , , .
, (, - , , ).
:
key <AD11> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_ha, Cyrillic_HA, bracketleft, braceleft]
};
key <AD12> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_hardsign, Cyrillic_HARDSIGN, bracketright, braceright]
};
key <AC10> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_zhe, Cyrillic_ZHE, colon, semicolon]
};
key <AC11> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_e, Cyrillic_E, apostrophe, quotedbl]
};
key <AB08> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_be, Cyrillic_BE, comma, less]
};
key <AB09> {
type[group2]="FOUR_LEVEL",
symbols[group2]=[Cyrillic_yu, Cyrillic_YU, period, greater]
};
, .
key <AB10> {
symbols[group2]=[slash, question]
};
, , , .
key <AE03> { [ 3, numbersign, number, apostrophe ] };
key <AE04> { [ 4, dollar ] };
key <AE06> { [ 6, asciicircum ] };
key <AE07> { [ 7, ampersand ] };
, .
Similarly, you can add a fifth layer, although so far I personally do not feel any need - the third is enough.
An interesting version of BackSpace in the end
And maybe enough to reach far, far into the far corner of the keyboard?
Put it BackSpace
on $mod3+Space
( $mod3
our third level modifier)!
key <SPCE> { [ space, space, BackSpace, BackSpace ] };
PS
All settings are, in principle, applicable to any Linux distribution using X.
Full configs can be found on GitHub .
This post has become for me a starting point for understanding how the keyboard can and should be configured.