Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use a Mac as a development box, but am slowly transitioning to Linux. So I am spending the majority of my time in the Linux guest VM while working. But I still spend a fair amount of time in Mac OS X, for things like email and such.

One issue I am having is changing contexts between the two keyboard layouts. I'm constantly hitting the other OS's keyboard shortcut to go to the start of a terminal line, or getting Command-C and Ctrl-C mixed up depending on what OS I am in.

Can anyone point me in the right direction to bring the Mac OS X and Linux (am using CentOS 6.3) basic OS keymappings into alignment? Since my ultimate goal is to move from OS X to Linux entirely, I would prefer changing OS x to match Linux, but am open to other alternatives.

share|improve this question
    
I am hoping there is something that works at a global level, as opposed to changing keymappings for all the different apps I may interact with. –  Lance Woodson Nov 26 '12 at 13:03
1  
I would suggest that as you wish to change the shortcuts of Mac OS, asking that the question will be moved to the "Ask Different" site will have a higher chances of getting your answer. You could edit and change your question here to ask for a list of shortcut keys to do a list of actions you are looking to replace and this will get you a "Linux" answer. –  David Kohen Nov 26 '12 at 13:52
add comment

2 Answers

KeyRemap4MacBook looks like it should do what you need. It's free and open source, and seems to have received good reviews.

share|improve this answer
    
Thanks, this looks like something worth investigating. I'll install it and post feedback afterwards. –  Lance Woodson Nov 27 '12 at 12:00
add comment

After experimenting a lot and going through all kinds of complicated configurations that are very hard to get right and to maintain, I found the following simple solution.

  1. In MacOS, switch Alt and Cmd: Settings/Keyboard/Special Keys. Option becomes Command. Command becomes Option.

  2. In Linux, make Cmd (super) a second Ctrl key: Create ~/.Xmodmap with:

remove mod4 = Super_R

remove mod4 = Super_L

add Control = Super_R

add Control = Super_L

Make sure you source .Xmodmap in .bashrc with:

$xmodmap .Xmodmap

The result is that the special keys are in the order you find them on any keyboard: CtrlWin/CmdAlt. I admit that having no super in Linux is a weak point, but it is easy to live without.

But the real magic is that all those commands that utilize ctrl in Linux and that utilize cmd in MaxOS are now mapped to the same physical key:


ctrl/cmd-c
ctrl/cmd-x
ctrl/cmd-v
ctrl/cmd-z
ctrl/cmd-b
ctrl/cmd-i
ctrl/cmd-u
etc

are now all performed with the same physical key combination.

This took away 80% off my annoyances while it is simple enough and does not mess to much with default keys that make sharing my laptop hard (pair programming).

I created little stickers to indicate the changed mapping: https://twitter.com/ejgroene/status/270933843765260289/photo/1

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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