4

I'd like to add left Ctrl+right Ctrl to the switch-windows keybinding. Is there a way to distinguish between the left Ctrl and right Ctrl keys when typing that command? Maybe something like:

gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab','<LControl><RControl>']"

However, that command doesn't work. I was wondering if there are actually key names specifically for the left Ctrl and the right Ctrl keys.

If you're curious why I'd want to do this, I have a Kinesis keyboard, and its default layout makes one stretch their left hand to hit Alt+Tab.

2 Answers 2

1
  • Edit /usr/share/X11/xkb/symbols/pc

    sudo gedit /usr/share/X11/xkb/symbols/pc
    
  • Remove Control_R from Control binding.Put // to comment original line and make new one with Control_L only:

    //modifier_map Control{ Control_L, Control_R };
    modifier_map Control{ Control_L };
    
  • Then use System Settings → Keyboard → Shortcuts → Navigation to set it.

1
  • This may work, but it changes a fundamental key mapping for the entire system, which may have unwanted side effects. My answer works around this downside, PTAL.
    – sprite
    Nov 17, 2022 at 15:35
0

I also have a Kinesis Advantage 2, and using Ubuntu. I opted to used <Left ControL>+<Right Control> for cycling to the next input method, since the default <Super>+Space isn't comfortable with this keyboard.

The easiest way to change it and make it persistent IMOHO is to use the dconf-editor tool which you can run from terminal. If you don't have it installed, just sudo apt install dconf-editor and then run it.

From there, search for your action's keybinding, in your case /org/gnome/desktop/wm/keybindings/switch-windows and in mine /org/gnome/desktop/wm/keybindings/switch-input-source. Once you're there, tick off the Use default value toggle and then you can type in this keybinding and hit apply so that the change takes effect: ['<Control>Control_R', '<Control>Control_L']

Variation:

If you want some more control, you can use ['<Control>Control_R'] to keybind /org/gnome/desktop/wm/keybindings/switch-applications and ['<Control>Control_L'] to keybind /org/gnome/desktop/wm/keybindings/switch-applications-backward for bi-directional control with only those two keys.

Explanation:

Using both controls is a bit tricky, because if you try to use ['<Control_L><Control_R>'], which was my first guess, it does nothing.

From my understanding after trial and error, the reason is this:

  1. <Control> is captured as a modifier key press for any of the two control keys, but Control isn't captured as a regular key press for either of them.
  2. On the flip side <Control_L> and <Control_R> are not captured as modifier key presses, but Control_L and Control_R are captured as regular key presses.

So, using the keybinding ['<Control>Control_R'] captures the combination when the left control if pressed first, followed by a press of the right control key while the left one is still pressed. Using the keybinding ['<Control>Control_L'] captures the reverse ordered combination. Combining the two, you can press both without caring what order they were pressed in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .