LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-16-2015, 09:37 AM   #1
alexbrui
Member
 
Registered: Nov 2009
Location: Ukraine
Distribution: Slackware 13.37
Posts: 38

Rep: Reputation: 0
Non cyclic keyboard switching and multimedia keys


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. Create files

/usr/share/X11/xkb/compat/mycompat
Code:
    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:
    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:
     
    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:
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. Any ideas?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gnome 3.1, Multimedia keyboard keys, Amarok... Gangrif Linux - Software 4 02-24-2012 06:28 PM
Non cyclic switching between keyboard layouts alexbrui Linux - General 8 02-17-2010 12:54 AM
Function keys on HP Multimedia Keyboard nymusicman Linux - Hardware 4 04-29-2009 10:27 PM
Keyboard Multimedia keys l00zer Linux - Hardware 3 04-01-2007 08:17 PM
keyboard multimedia keys devit Linux - General 1 07-19-2006 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration