Skip to content

Instantly share code, notes, and snippets.

@ralexx
Last active July 18, 2019 01:23
Show Gist options
  • Save ralexx/003d7f96bd23633242a2 to your computer and use it in GitHub Desktop.
Save ralexx/003d7f96bd23633242a2 to your computer and use it in GitHub Desktop.
Linux Mint xfce: swap Super_L and Control_L to mimic the Mac keyboard's Cmd key placement

First, unbind the left key from the Whisker menu 1, 4.

Open the file:

/usr/share/mint-configuration-xfce/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

and comment out the string:

<property name="Super_L" type="string" value="xfce4-popup-whiskermenu"/>

Next create or modify the file ~/.Xmodmap: 2, 3

! -*- coding: utf-8 -*-
! http://xahlee.info/linux/linux_swap_control_and_alt_xmodmap.html

! swap Ctrl and Super keys

! here's the default setting on special keys
!  xmodmap -pke | grep -P '(Control|Super|Alt|Menu)'

! keycode  37 = Control_L NoSymbol Control_L
! keycode  64 = Alt_L Meta_L Alt_L Meta_L
! keycode 105 = Control_R NoSymbol Control_R
! keycode 108 = Alt_R Meta_R Alt_R Meta_R
! keycode 133 = Super_L NoSymbol Super_L
! keycode 134 = Super_R NoSymbol Super_R
! keycode 135 = Menu NoSymbol Menu
! keycode 147 = XF86MenuKB NoSymbol XF86MenuKB
! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
! keycode 206 = NoSymbol Super_L NoSymbol Super_L

! Erase existing bindings
clear control
clear mod4
! Map key 37 (left ctrl) to Super_L (i.e. 'cmd')
keycode  37 = Super_L
! Map key 133 (left cmd) to Control_L (i.e. 'ctrl)
keycode 133 = Control_L
! And update modifier settings
add control = Control_L
add mod4    = Super_L
@ralexx
Copy link
Author

ralexx commented Jun 19, 2019

This worked for Mint 16 but I have not tested it since. Apologies for not specifying version compatibility. You should restart although that may not fix this if xfce4-keyboard-shortcuts.xml or ~/.Xmodmap settings have changed.

@willbuck
Copy link

xfce4-keyboard-shortcuts.xml didn't exist on my install. I don't think I have the whisker menu?

@willbuck
Copy link

I was able to figure out how to make it happen though; under Menu > Keyboard Preferences > Layouts > Options > there were a bunch of toggles for swapping alt, ctrl and windows keys around. My thumb is right where it wants to be now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment