0

I'm trying to swap my left Windows key with the <>|key. This worked very well on the vterm using a keymap file that does just that. However, I cannot get this to work on X (tried on KDE as well as Mate - both exhibit the same behavior)

Whether I use xmodmap or an xkb symbol config doing that, the result is the same: the <>| key stops working and the left Windows key keeps being that key but additionally also emits a < when pressed.

With xev I determined that my <>| key has the code 94 and my left Windows key has 133, so I've tried this:

xmodmap -e "keycode 133 = less greater bar NoSymbol U0149 brokenbar U266A NoSymbol"
xmodmap -e "keycode 94 = Super_L"

The xkb symbol config I've tried looks like this and has the same effect as described above:

partial alphanumeric_keys
xkb_symbols "defoo" {
  include "de(basic)"
  name[Group1] = "German (foo)";
  key <LWIN> { [ less, greater, bar, NoSymbol, U0149, brokenbar, U266A, NoSymbol ] };
  key <LSGT> { [ Super_L ] };
};

Now what? I really need to swap those keys.

Edit: I'm on Ubuntu 18.04

Edit: Tried fiddling with the modifier keys as well. xmodmap -pm says my Super keys are assigned to mod4, so:

xmodmap -e "clear mod4"

However, this had no effect, i.e. the Windows key acted exactly as before.

1 Answer 1

0

As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.

Pro:

  • Works transparently with any layout and application as it changes the event codes for the keys

Con:

  • Applies to all evdev Keyboards
  • Change applied to system file (might break later)

Diff:

$ diff /usr/share/X11/xkb/keycodes/evdev{,.bak}
8c8
<         <LWIN> = 94;
---
>         <LSGT> = 94;
74c74
<   <LSGT> = 133;
---
>   <LWIN> = 133;

You must log in to answer this question.

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