How to swap a modifier key with a character key on X?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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.
keyboard-layout
add a comment |Â
up vote
0
down vote
favorite
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.
keyboard-layout
You also need to an appropriateremove
andadd
of the modifier map seen byxmodmap -pm
â meuh
Aug 8 at 6:05
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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.
keyboard-layout
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.
keyboard-layout
keyboard-layout
edited Aug 8 at 6:17
asked Aug 8 at 5:55
luxifer
43117
43117
You also need to an appropriateremove
andadd
of the modifier map seen byxmodmap -pm
â meuh
Aug 8 at 6:05
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15
add a comment |Â
You also need to an appropriateremove
andadd
of the modifier map seen byxmodmap -pm
â meuh
Aug 8 at 6:05
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15
You also need to an appropriate
remove
and add
of the modifier map seen by xmodmap -pm
â meuh
Aug 8 at 6:05
You also need to an appropriate
remove
and add
of the modifier map seen by xmodmap -pm
â meuh
Aug 8 at 6:05
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
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;
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
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;
add a comment |Â
up vote
0
down vote
accepted
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;
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
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;
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;
answered Aug 8 at 10:13
luxifer
43117
43117
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461206%2fhow-to-swap-a-modifier-key-with-a-character-key-on-x%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You also need to an appropriate
remove
andadd
of the modifier map seen byxmodmap -pm
â meuh
Aug 8 at 6:05
@meuh: just tried that - had no effect whatsoever :(
â luxifer
Aug 8 at 6:15