Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Multimedia keys and non-cyclic switching of keyboard layouts

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
voltron
Posts: 12
Joined: 2015-10-06 06:44

Multimedia keys and non-cyclic switching of keyboard layouts

#1 Post by voltron »

After installing Debian 8.2 I tested my multimedia keys and they all are correctly detected by xev and works as expected. Then I start to configure my keyboard.

I need to use three keyboard layouts EN, UA and RU. By default I can switch between them using selected keyboard shortcut with following pattern: en→ua→ru→en→ua... But I want to switch layouts independently, using different keys for each layout, for example:
  • CapsLock — enable EN layout
  • Shift+CapsLock — enable UA layout
  • Ctrl+CapsLock — enable RU layout
After googling and reading different forums I come to following solution (here is documents and discussion in russian). Create files

/usr/share/X11/xkb/compat/mycompat

Code: Select all

 
default partial xkb_compatibility "default"  {
   interpret Mae_Koho {
       action= LockGroup(group=3);
   };
   interpret Zen_Koho {
       action= LockGroup(group=4);
   };
};
/usr/share/X11/xkb/symbols/mysymbol

Code: Select all

partial modifier_keys xkb_symbols "caps_1" {
    key <CAPS> {
        [ ISO_First_Group, ISO_Last_Group ]
    };
};

partial modifier_keys xkb_symbols "caps_2" {
    key <CAPS> {
        [ ISO_First_Group ]
    };
    key <RCTL> {
        [ ISO_Last_Group ]
    };
};

partial modifier_keys xkb_symbols "caps_4" {
    replace key <CAPS> {
				type = "FOUR_GROUPS",
        [ ISO_First_Group, ISO_Last_Group, Mae_Koho, Zen_Koho ]
    };
};
/usr/share/X11/xkb/types/mytype

Code: Select all

 
partial xkb_types "four_groups" {
    type "FOUR_GROUPS" {
        modifiers = Shift+Control;
        map[None] = Level1;
        map[Shift] = Level2;
        map[Control] = Level3;
        map[Control+Shift] = Level4;
        level_name[Level1] = "Base";
        level_name[Level2] = "Shift";
        level_name[Level3] = "Ctrl";
        level_name[Level4] = "Ctrl Shift";
    };
};
And use command to setup keyboard

Code: Select all

setxkbmap -symbols "pc+us:1+ua(winkeys):2+ru:3+us(dvorak):4+compose(ralt)+mysymbol(caps_4)" -types "complete+mytype(four_groups)" -compat "complete+mycompat" -print | xkbcomp - $DISPLAY &>/dev/null
This works perfectly, but all multimedia keys now not recognized by xev and as result they does not work. I know that I can use xmodmap to map keys, but maybe same result can be achieved by fixing some of the newly created files or setxkbmap+xkbcomp command listed above.

Post Reply