Remapping Super_R key on Ubuntu

PUBLISHED ON 8 SEPTEMBER 2019
LAST MODIFIED ON 8 SEPTEMBER 2019

Ever since after switching my Dell XPS 15 to Ubuntu 18.04, I had a problem with the Super (Windows) keys when switching between the Laptop keyboard and my Steelseries 6gv2. The 6gv2 has no dedicated left Super key, it instead uses it as a function key. This is so that you don’t accidentally go to the desktop when playing games and hitting it.

So over the course of the past year, I used the GNOME Tweaks tool to force the Super key to be the right key. When using the laptop keyboard I pressed ALT + F1 to open the application drawer. While this is working, it bugged me out that I cannot simply using both keys, no matter where I’m typing on.

Today I finally found a solution to this issue. Using xmodmap and an autostart configuration, you can override the Super_R keycode with Super_L.

Configuration

  • figure out the keycode for the default Super_R key. Run xmodmap -pke and grep for Super_R
  • xmodmap -pke | grep -i super_r (in my case it is keycode 134)
  • create a new file .Xmodmap in your home directory
  • keycode 134 = Super_L
  • add an autostart configuration so your override gets applied on startup
tee "$HOME/.config/autostart/xmodmap.desktop" > /dev/null << EOL
[Desktop Entry]
Type=Application
Exec=bash -c "[[ -f $HOME/.Xmodmap ]] && xmodmap $HOME/.Xmodmap"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=xmodmap custom config
Name=xmodmap custom config
Comment[en_US]=
Comment=
EOL