Skip to main content
add ps
Source Link
rzlvmp
  • 111
  • 3

Here is a very detailed answer that helped me.

What I did to activate Ctrl + Space selector for keyboard layout →

  1. Add new selector grp:lctrl_space_toggle line in /usr/share/X11/xkb/rules/evdev.lst :
! option
  grp                  Switching to another layout
  grp:switch           Right Alt (while pressed)
  grp:lswitch          Left Alt (while pressed)
  ...
  grp:lctrl_space_toggle Ctrl+Space (Custom layout selector)
  ...
  1. Add new selector grp:lctrl_space_toggle line to /usr/share/X11/xkb/rules/evdev:
! option        =       symbols
  grp:shift_toggle      =       +group(shifts_toggle)
  altwin:menu           =       +altwin(menu)
  altwin:menu_win       =       +altwin(menu_win)
  ...
  grp:lctrl_space_toggle =      +group(lctrl_space_toggle)
  ...
  1. Add the group block to /usr/share/X11/xkb/symbols/group:
partial modifier_keys
xkb_symbols "lctrl_space_toggle" {
    key <SPCE> {
        type[Group1]="PC_CONTROL_LEVEL2",
        symbols[Group1] = [ space, ISO_Next_Group ]
    };
};

* I added this block between other grp: groups

  1. Get current keyboard options:
setxkbmap -print -verbose 10 | grep options:

Output (in my case):

options:    ctrl:nocaps,grp:win_space_toggle
  1. Here is default grp:win_space_toggle will override our parameter, so we should clear all options first:
setxkbmap -option
  1. Add new layout selector option + other options that was set before (except grp:... one):
setxkbmap -option grp:lctrl_space_toggle,ctrl:nocaps
  1. Profit

PS it is possible that some GUI tools may override this behavior on reboot (SystemKeyboardAdvanced feature in KDE did this stuff in my case), so we have to turn off any shortcut tweaks to avoid it. Also it may be useful to add our custom parameters to /etc/default/keyboard:

...
XKBOPTIONS="grp:lctrl_space_toggle,ctrl:nocaps"
...

Here is a very detailed answer that helped me.

What I did to activate Ctrl + Space selector for keyboard layout →

  1. Add new selector grp:lctrl_space_toggle line in /usr/share/X11/xkb/rules/evdev.lst :
! option
  grp                  Switching to another layout
  grp:switch           Right Alt (while pressed)
  grp:lswitch          Left Alt (while pressed)
  ...
  grp:lctrl_space_toggle Ctrl+Space (Custom layout selector)
  ...
  1. Add new selector grp:lctrl_space_toggle line to /usr/share/X11/xkb/rules/evdev:
! option        =       symbols
  grp:shift_toggle      =       +group(shifts_toggle)
  altwin:menu           =       +altwin(menu)
  altwin:menu_win       =       +altwin(menu_win)
  ...
  grp:lctrl_space_toggle =      +group(lctrl_space_toggle)
  ...
  1. Add the group block to /usr/share/X11/xkb/symbols/group:
partial modifier_keys
xkb_symbols "lctrl_space_toggle" {
    key <SPCE> {
        type[Group1]="PC_CONTROL_LEVEL2",
        symbols[Group1] = [ space, ISO_Next_Group ]
    };
};

* I added this block between other grp: groups

  1. Get current keyboard options:
setxkbmap -print -verbose 10 | grep options:

Output (in my case):

options:    ctrl:nocaps,grp:win_space_toggle
  1. Here is default grp:win_space_toggle will override our parameter, so we should clear all options first:
setxkbmap -option
  1. Add new layout selector option + other options that was set before (except grp:... one):
setxkbmap -option grp:lctrl_space_toggle,ctrl:nocaps
  1. Profit

Here is a very detailed answer that helped me.

What I did to activate Ctrl + Space selector for keyboard layout →

  1. Add new selector grp:lctrl_space_toggle line in /usr/share/X11/xkb/rules/evdev.lst :
! option
  grp                  Switching to another layout
  grp:switch           Right Alt (while pressed)
  grp:lswitch          Left Alt (while pressed)
  ...
  grp:lctrl_space_toggle Ctrl+Space (Custom layout selector)
  ...
  1. Add new selector grp:lctrl_space_toggle line to /usr/share/X11/xkb/rules/evdev:
! option        =       symbols
  grp:shift_toggle      =       +group(shifts_toggle)
  altwin:menu           =       +altwin(menu)
  altwin:menu_win       =       +altwin(menu_win)
  ...
  grp:lctrl_space_toggle =      +group(lctrl_space_toggle)
  ...
  1. Add the group block to /usr/share/X11/xkb/symbols/group:
partial modifier_keys
xkb_symbols "lctrl_space_toggle" {
    key <SPCE> {
        type[Group1]="PC_CONTROL_LEVEL2",
        symbols[Group1] = [ space, ISO_Next_Group ]
    };
};

* I added this block between other grp: groups

  1. Get current keyboard options:
setxkbmap -print -verbose 10 | grep options:

Output (in my case):

options:    ctrl:nocaps,grp:win_space_toggle
  1. Here is default grp:win_space_toggle will override our parameter, so we should clear all options first:
setxkbmap -option
  1. Add new layout selector option + other options that was set before (except grp:... one):
setxkbmap -option grp:lctrl_space_toggle,ctrl:nocaps
  1. Profit

PS it is possible that some GUI tools may override this behavior on reboot (SystemKeyboardAdvanced feature in KDE did this stuff in my case), so we have to turn off any shortcut tweaks to avoid it. Also it may be useful to add our custom parameters to /etc/default/keyboard:

...
XKBOPTIONS="grp:lctrl_space_toggle,ctrl:nocaps"
...
Source Link
rzlvmp
  • 111
  • 3

Here is a very detailed answer that helped me.

What I did to activate Ctrl + Space selector for keyboard layout →

  1. Add new selector grp:lctrl_space_toggle line in /usr/share/X11/xkb/rules/evdev.lst :
! option
  grp                  Switching to another layout
  grp:switch           Right Alt (while pressed)
  grp:lswitch          Left Alt (while pressed)
  ...
  grp:lctrl_space_toggle Ctrl+Space (Custom layout selector)
  ...
  1. Add new selector grp:lctrl_space_toggle line to /usr/share/X11/xkb/rules/evdev:
! option        =       symbols
  grp:shift_toggle      =       +group(shifts_toggle)
  altwin:menu           =       +altwin(menu)
  altwin:menu_win       =       +altwin(menu_win)
  ...
  grp:lctrl_space_toggle =      +group(lctrl_space_toggle)
  ...
  1. Add the group block to /usr/share/X11/xkb/symbols/group:
partial modifier_keys
xkb_symbols "lctrl_space_toggle" {
    key <SPCE> {
        type[Group1]="PC_CONTROL_LEVEL2",
        symbols[Group1] = [ space, ISO_Next_Group ]
    };
};

* I added this block between other grp: groups

  1. Get current keyboard options:
setxkbmap -print -verbose 10 | grep options:

Output (in my case):

options:    ctrl:nocaps,grp:win_space_toggle
  1. Here is default grp:win_space_toggle will override our parameter, so we should clear all options first:
setxkbmap -option
  1. Add new layout selector option + other options that was set before (except grp:... one):
setxkbmap -option grp:lctrl_space_toggle,ctrl:nocaps
  1. Profit