Configuring Linux's Super key like OSX's Command key

Table of Contents

  1. Configure Herbstluft Window Manager
  2. Configure Sakura
  3. Configure Firefox
    1. Convert Command key from Super to Meta
    2. Set accel key in about:config

Configure Herbstluft Window Manager

If necessary, copy /etc/xdg/herbstluftwm/autostart to ~/.config/herbstluftwm/autostart

In ~/.config/herbstluftwm/autostart change:
Mod=Mod1
hc keybind $Mod-Shift-c close
to
Mod=Mod4
hc keybind $Mod-q close

Configure Sakura

Set these settings in your ~/.config/sakura/sakura.conf change:
add_tab_accelerator=5
del_tab_accelerator=5
switch_tab_accelerator=8
move_tab_accelerator=5
copy_accelerator=5
scrollbar_accelerator=5
open_url_accelerator=5
font_size_accelerator=4
set_tab_name_accelerator=5
add_tab_key=T
del_tab_key=W
prev_tab_key=Left
next_tab_key=Right
copy_key=C
paste_key=V
scrollbar_key=S
set_tab_name_key=N
to
add_tab_accelerator=64
del_tab_accelerator=64
switch_tab_accelerator=64
move_tab_accelerator=65
copy_accelerator=64
scrollbar_accelerator=64
open_url_accelerator=64
font_size_accelerator=64
set_tab_name_accelerator=64
add_tab_key=t
del_tab_key=w
prev_tab_key=Left
next_tab_key=Right
copy_key=c
paste_key=v
scrollbar_key=s
set_tab_name_key=n

Configure Firefox

Firefox's ui.key.accelKey requires a DOM_VK key code, and there isn't one for Super, so we'll have to use Meta instead.

If you want to send Meta key combinations in a terminal, you can still do that with ESC <key> or alt-<key>

Convert Command key from Super to Meta

Run xmodmap to key the key codes for your Super keys
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Alt_L (0xcc)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Add to ~/.xmodmap:
keycode 0x85 = Meta_L
keycode 0x86 = Meta_R
keycode 0xce = Meta_L
Run xmodmap ~/.xmodmap to apply the change, and xmodmap to verify that it worked:
$ xmodmap ~/.xmodmap
$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Alt_L (0xcc)
mod2 Num_Lock (0x4d)
mod3
mod4 Meta_L (0x85), Meta_R (0x86), Meta_L (0xce)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Persist the change by adding this to the top of your .xinitrc:
! test -f ~/.xmodmap || xmodmap ~/.xmodmap

Set accel key in about:config

Open about:config and search for ui.key.accelKey
Set ui.key.accelKey to 224 (the DOM_VK code for Meta)
Restart Firefox