0

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?

1 Answer 1

0

After reading more carefully the instructions of setxkbmap I found there is a specially defined option to swap all the three keys:

$ setxkbmap -option ctrl:swap_lalt_lctl_lwin

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.