Sample Header Ad - 728x90

How to (permently) set keyboard mappings using setxkbmap? It gives an error

0 votes
1 answer
1264 views
I am diving into custom keyboard mappings. Basically, I just want to switch the Alt_L with Ctrl_L and Alt_R with Ctrl_R (kind of like Command on MacBooks). In the file /usr/share/X11/xkb/symbols/ctrl there is already a definition for a swap of Alt_L with Ctrl_L (So adding a definition for the opposite side should be a piece of cake) called swap_lalt_lctl.  However, when I type the following:
setxkbmap -layout us -option ctrl:swap_lalt_lctl
in the terminal, I receive the following error:
Error loading new keyboard description
I have already spent several hours googling and trying different things to resolve the problem, like: sudo, clearing cache, rebooting, explicitly stating machine info in command, but nothing seems to work. Strange thing is that setxkbmap -layout us works fine and also setxkbmap with other options seems to be working.  It appears that it affects only the ctrl: options. If somebody could help me out, suggest some solution paths, I would be really grateful. Oh, and lsb_release -a gives:
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
___ Without taking a deep dive into xkb, the closest I get is setting the "Ctrl is mapped to Alt, Alt to Win" option in the Gnome-Tweaks tool.
Asked by vshas (109 rep)
Nov 9, 2022, 10:15 PM
Last activity: Nov 11, 2022, 12:54 PM