4

I want to set custom shortcut to change keyboard layout using setxkbmap. For example win_caps (Win+CapsLock). This option is not listed in /usr/share/X11/xkb/rules/base.lst

How can I achieve this?

2
  • 1
    You'll have to define your own custom option (example). Commented Nov 23, 2015 at 14:21
  • @don_crissti I haven't got a time to try to write it with all the grasp I could gather, but after a hour or so browsing through the Internet I still didn't get how to write custom grp toggle option. If you could at least give me a link to some kind of comprehensive xkb configuration guide I would greatly appreciate it. Commented Nov 27, 2015 at 23:35

1 Answer 1

7

You'll have to define a custom option e.g. win_caps_toggle.
Add the following definition to your /usr/share/X11/xkb/symbols/group:

// toggle using win + capslock as combo partial modifier_keys xkb_symbols "win_caps_toggle" { key <CAPS> { type[Group1]="PC_SUPER_LEVEL2", symbols[Group1] = [ Caps_Lock, ISO_Next_Group ] }; }; 

and the following description to your usr/share/X11/xkb/rules/evdev.lst:

grp:win_caps_toggle Win+Caps Lock 

anywhere under the grp section (e.g. under grp:caps_toggle).
You can then run

setxkbmap -option grp:win_caps_toggle 

to set Win+CapsLock as the shortcut that changes the keyboard layout.


Note: this solution doesn't work with gnome 3. I think in order to make it work some stuff has to be disabled in gnome; I've tried disabling gnome-settings-daemon keyboard plugin and mutter overview key but no go. Works fine with other DE's though.

2
  • Thanks a lot! I'll try to implement this tomorrow, as I'll have time for it. And please, can you give me a link to some kind of docs that would explain the process of xkb configuration? Commented Nov 30, 2015 at 21:00
  • I think this doesn't work in gnome because gnome-shell implements differently the work with XKB. Sorry for not being more specific, I don't speak XKB. Commented Oct 19, 2016 at 13:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.