How do I remap command key to be the control key on a Macbook 4,1?

Try this:

cat > ~/.xmodmaprc
! 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

To end the input, press Ctrl+D.

To test you can run:

xmodmap ~/.xmodmaprc

Finally, you should add this command to startup applications.

This should get you started. If this does not quite work for you, checkout this for more info:

man xmodmap

To watch which key press corresponds to which internal keycode, run

xev

and press some keys when the little white window has the focus. The keycodes won't change (133 will always be 133, but you should see the name of 133 before as Control_L and after this procedure, after you log in again, it should be Super_L.


A quick way to do this would be to goto System -> Preferences -> Keyboard -> Layouts tab -> Options -> Alt/Win key behavior -> select Win key as control

Viola!

But of course there is no Win key on a Mac.


For anyone using KDE, check under System Settings > Input Devices > Keyboard > Advanced. You'll need to enable "Configure keyboard options", open up "Alt/Win key behavior", then check "Ctrl is mapped to Win keys (and the usual Ctrl keys)". There is an identical setting for Alt mapping to the Win keys if you'd prefer the Control key be Alt.

Tags:

Keyboard

Mac