Games with xkbcomp - configure asymmetric keyboard layout switching

    I want to share with the community my dislike for cyclically switching keyboard layouts. Cyclically, how is it? This is when English follows Russian, Russian Ukrainian, Ukrainian again English, etc.
    How easy life is when you get used to asymmetric switching layouts. This is when switching to each layout corresponds to its own combination.
    For example, if you want English, press CapsLock (a very often very necessary key, right?), Russian - Shift + CapsLock, Ukrainian Ctrl + CapsLock. Seems uncomfortable? No matter how! When you get used to it, you won’t be able to break the habit.

    So how to do it in your favorite X's? Here is a small keymap:
    xkb_keymap {
        xkb_keycodes {include "evdev + aliases (qwerty)"};
        xkb_geometry {include "pc (pc104)"};
        xkb_compatibility {include "complete"};
        xkb_types {
            include "complete"
            type "THREE_GROUPS" {
                modifiers = Shift + Control + Alt;
                map [None] = Level1;
                map [Shift] = Level2;
                map [Control] = Level3;
                map [Control + Shift] = Level4;
                map [Alt] = Level5;
                level_name [Level1] = "Base";
                level_name [Level2] = "Shift";
                level_name [Level3] = "Ctrl";
                level_name [Level4] = "Ctrl Shift";
                level_name [Level5] = "Alt";
        xkb_symbols {
            include "pc + us + ru: 2 + ua: 3 + us (dvorak): 4 + level3 (menu_switch) + inet (evdev)"
            replace key {
                type = "THREE_GROUPS",
                actions [Group1] = [LockGroup (group = 1), LockGroup (group = 2), LockGroup (group = 3), LockMods (modifiers = Lock), LockGroup (group = 4)]

    The "highlight" here is even visible to the naked eye. Well and more. Of course, this config in each section can be supplemented with other definitions - this is just an ordinary keymap that is fed to xkbcomp.

    In order for this config to work every time you enter your favorite DE, save the above config, say, in / usr / share / X11 / xkb / keymap / three_groups and write the following small script in /etc/X11/Xsession.d/60xkb-lang:
    cd / usr / share / X11 / xkb / && xkbcomp keymap / three_groups $ DISPLAY &> / dev / null

    A small note in the end. Several times when updating my beloved Debian, I came across a problem that the developers rewrote something and redefined it in xkb, as a result of which it was necessary to try and shovel the config again to find the desired combination of include in symbols.

    Once, once again updated, in frustrated feelings, I discovered that the Up, Down, Left, Right, Home, etc. keys do not work out for me. when my keymap compiles. But at the same time they work great with, so to speak, the default settings in Gnome. A simple command that was launched with default settings:
    xkbcomp $ DISPLAY - | egrep "^ xkb_"

    allowed to see the desired combination for include. The following output will be obtained:
    xkb_keymap {
    xkb_keycodes "evdev + aliases (qwerty)" {
    xkb_types "complete" {
    xkb_compatibility "complete" {
    xkb_symbols "pc + us + ru: 2 + ua: 3 + us (dvorak): 4 + level3 (menu_switch) + inet (evdev)" {
    xkb_geometry "pc (pc104)" {

    I recall that happiness knew no bounds! ;)

    Well, actually, on this optimistic note, this note can be finished. Try asymmetric switching layouts, get used to it - it will be difficult to refuse;)

    Also popular now: