Keyboard settings: Missing XKB option for the CTRL key

I’ve been thinking about switching to KDE, and today I booted from a Fedora 40 KDE edition live USB, and played with the system a bit. I was just about to decide to install to the hard drive, but then I realized that the keyboard settings dialog didn’t provide an option to use the right Alt key as an additional Ctrl key, which is sadly a dealbreaker for me. Is this a bug or a (missing) feature? :slight_smile:

There are 13 options for the Ctrl key listed at Settings > Input devices > keyboard > Advanced > Ctrl position, although XKB provides 14 options for the Ctrl key by default, where the missing one (i.e. ralt_rctrl) is one of two XKB options that I use on GNOME with the command below:

gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:ralt_rctrl,ctrl:swapcaps']"

These two options can also be used directly with the setxkbmap utility outside a desktop environment:

setxkbmap -option ctrl:ralt_rctrl -option ctrl:swapcaps

The 14 XKB options for the Ctrl key are described in the file /usr/share/X11/xkb/symbols/ctrl on my system:

// Eliminate CapsLock, making it another Ctrl.
… "nocaps" …

// Make the left Ctrl key a left Meta.
… "lctrl_meta" …

// Swap the functions of the CapsLock key and the left Ctrl key.
… "swapcaps" …

// Make the left Ctrl key a left Hyper,
// and the CapsLock key a left Control.
… "hyper_capscontrol" …

// Move Ctrl to the leftmost key on the middle row and CapsLock to the
// leftmost key on the bottom row.  Only works if the geometry or keycodes
// file has defined appropriate aliases for the keys in question.
… "ac_ctrl" …

// Move Ctrl to the leftmost key on the bottom row and CapsLock to the
// leftmost key on the middle row.  Only works if the geometry or keycodes
// file has defined appropriate aliases for the keys in question.
… "aa_ctrl" …

// Right Ctrl functions as another right Alt.
… "rctrl_ralt" …

// Menu key functions as another right Ctrl.
… "menu_rctrl" …

// Right Alt key functions as another right Ctrl.
… "ralt_rctrl" …

// Swap the functions of the left Alt key and the left Ctrl key.
… "swap_lalt_lctl" …

// Swap the functions of the right Alt key and the right Ctrl key.
… "swap_ralt_rctl" …

// Swap the functions of the left Win key and the left Ctrl key.
… "swap_lwin_lctl" …

// Swap the functions of the right Win key and the right Ctrl key.
… "swap_rwin_rctl" …

// Map Ctrl to the left Alt key, Alt to the left Win key,
// and Super to the left Ctrl key.
… "swap_lalt_lctl_lwin" …

Am I missing something? Can this option be missing only in a live session? (not likely? :slight_smile: )

Thanks.

This is a bug in xkeyboard-config, which provides the data files used to fill the configuration UI.

See ctrl:ralt_rctrl option is missing in Additional Layout Options (#298) · Issues · GNOME / GNOME Tweaks · GitLab and Some rules entries have no corresponding entry in the base.xml files (#445) · Issues · xkbdesc / xkeyboard-config · GitLab

Add/remove options that didn't have matching entries in base.xml (!670) · Merge requests · xkbdesc / xkeyboard-config · GitLab fixed this upstream.

You should be able to do the equivalent of what you did on Gnome by adding

Options=ctrl:ralt_rctrl
ResetOldOptions=true

to ~/.config/kxkbrc

1 Like

Thank you very much, that 3 months old commit to xkeyboard-config indeed added the ralt_rctrl option to the base.xml.

I think ResetOldOptions would reset all other options as well, which is also what running setxkbmap -option without any arguments does.

So, having the below lines in ~/.config/kxkbrc suffice? Is comma the right delimiter there? Can the reset line be omitted by the way?

Options=ctrl:ralt_rctrl,ctrl:swapcaps
ResetOldOptions=true

And, can this be tested on a live session?

Okay I installed to the drive, and currently ~/.config/kxkbrc have the lines below, which work as expected:

[Layout]
Options=ctrl:ralt_rctrl,ctrl:swapcaps
ResetOldOptions=true 

Settings are a bit all over the place, and there are glitches (bugs), such as the “KWin” item under the shortcuts pane is suddently disappearing and gets listed as a second “System settings” if task switching shortcut is set from both the shortcuts pane and “Window Management” under “Apps & Windows” group, although it returns back to “KWin” after a restart. Probably an expected, and unwanted, side-effect of having the same setting in multiple places (in the same windows).

And there are other minor issues, such as minor delay while starting Overview, window indexing starts from the last one in a counter-intuitive way when arrows are used to select windows in the overview, etc.

I haven’t tested extensively, but I’m sold, I’ve switched to KDE from GNOME at this moment, we’ll see how that goes.

One can only hope the settings will be tidied up by grouping under many less headings, which is a bad dream reminiscing a certain traumatizing capital-W incident of the past :slight_smile:, and KDE will grow stronger with a better support for a keyboard-driven and CLI-based workflow.

Font rendering, and the whole graphical aspect of the desktop environment is objectively better than GNOME, I’d say stellar in general :slight_smile: Thank you very much.