I have used xkb to remap the right windows key (RWIN) to Hyper_R because I want to use it with AutoKey for some special shortcuts. I did it by editing


modifying the RWIN line:

  key <RWIN> {  [ Hyper_R   ]   };

(Here's the answer that guided me)

From what I can tell, this works and the right Windows key now fires Hyper_R. However, It seems that in Ubuntu (Xubuntu to be exact), Hyper and Super somehow are doing the same thing. So Super + e launches the editor, and so does Hyper + e.

I'm not sure why this is or where I can change this behavior. I want Hyper and Super to be different modifiers.

  • There was a thing on it here, though I don't think the dialogue now exists in 13.10... – Wilf Feb 20 '14 at 12:32
  • But this has to be configurable somewhere, right? – Alexander Rechsteiner Feb 20 '14 at 12:35
  • You may be able to find them in dconf-editor – Wilf Feb 20 '14 at 12:38
  • 1
    Thanks, but no luck there. Damn, this whole keyboard remapping thing on Linux gives me diabetes. – Alexander Rechsteiner Feb 20 '14 at 12:46
  • +1 :concord (on the diabetes part). I was not able to find a nice, comprehensive, detailed guide on how the keyboard is managed in Ubuntu. There are a series of interaction between gnome-control-center, gnome-tweak-tool, xkbd, xmodmap which are quite complex and, worst, undocumented. If you find some link please share it! (Although I suspect almost no one knows it for real. Just see at the unfixability of bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/… ) – Rmano Feb 20 '14 at 15:16

For some reason Ubuntu currently assigns both Super and Hyper to Mod4. You can see this in /usr/share/X11/xkb/symbols/pc:

 key <SUPR> {   [ NoSymbol, Super_L ]   };
 modifier_map Mod4   { <SUPR> };

 key <HYPR> {   [ NoSymbol, Hyper_L ]   };
 modifier_map Mod4   { <HYPR> };

I was able to change this to put super and hyper on separate modifiers without needing to be root or modify any system files. I'm not sure if this is the best way as I am definitely not an xkb expert, but it's a way that has been reliable for me.

First, create a local symbols file. I have mine in ${HOME}/.config/xkb/symbols/local. This assigns Super to Mod3 and Hyper to Mod4.

default  partial modifier_keys
xkb_symbols "superhyper" {

    modifier_map Mod3 { Super_L, Super_R };

    key <SUPR> {    [ NoSymbol, Super_L ]   };
    modifier_map Mod3   { <SUPR> };

    key <HYPR> {    [ NoSymbol, Hyper_L ]   };
    modifier_map Mod4   { <HYPR> };

Then recompile the existing map to add a "local":

setxkbmap -print | sed -e '/xkb_symbols/s/"[[:space:]]/+local&/' | xkbcomp -I${HOME}/.config/xkb - ${DISPLAY}

Put this in a script to be run when you log in. You can run it as an ordinary user.

  • Is it possible to just edit that file in place to change HYPR to Mod3? – Alex Moore-Niemi Mar 25 '17 at 19:37
  • 3
    You can do this. The benefits of not editing in place is that a system update won't overwrite your changes. – ergosys Mar 26 '17 at 17:37
  • For myself, I had it working briefly with raw.githubusercontent.com/jabbalaci/dotfiles/master/.Xmodmap though it keeps mysteriously stopping... – Alex Moore-Niemi Mar 26 '17 at 17:40
  • Also a drawback of my answer's method that I've found is that if your keyboard is unplugged or loses USB communication due to a random glitch, the script must be run again. There is probably some way to rerun it automatically, but I haven't looked into it. Fortunately the random glitch thing only happens once or so a month for me. If you edit the system files this shouldn't be an issue. So there are pluses and minuses. – ergosys Mar 26 '17 at 17:45
  • 2
    I use that as well. There's already a canned setup for it, so I use: setxkbmap -option 'caps:hyper' – ergosys Mar 27 '17 at 1:30

With xmodmap you can change this behavior with 2 commands:

## Hyper_L is mod4 by default, we will "move" it to Mod3
xmodmap -e "remove mod4 = Hyper_L"
xmodmap -e "add mod3 = Hyper_L"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.