I'm using MX Linux with Xfce and trying to swap three keys:
- Ctrl → Win (Super)
- Win → Alt
- Alt → Ctrl
Swapping two keys at a time works using setxkbmap, for example:
setxkbmap -option ctrl:swap_lalt_lctl
However, if I try to add a second swap, like:
setxkbmap -option ctrl:swap_lalt_lctl,altwin:swap_alt_win
I end up with a repetition of the same key instead of a clean three-way swap.
Attempted Solution
I created a custom XKB symbols file:
xkb_symbols "ctrl_win_alt_swap" {
include "us" // Keep the default US layout
key <LCTL> { [ Super_L ] }; // Left Ctrl → Left Win
key <LWIN> { [ Alt_L ] }; // Left Win → Left Alt
key <LALT> { [ Control_L ] }; // Left Alt → Left Ctrl
};
I apply this with:
setxkbmap -layout custom -variant ctrl_win_alt_swap
The remapping works, except for one issue:
- Pressing Alt alone produces
Ctrl, which is expected. - Pressing Alt in combination with another key results in Ctrl+Alt, instead of just
Ctrl.
Why does this happen, and how can I properly swap Ctrl, Win, and Alt without modifier conflicts?