Key+Mapping+for+X11+Apps

[|Better Keyboard Shortcuts for Mac X11 Apps]
I have always found the integration of X11 apps in Mac OS X quite alright, apart from the fact that for a native Mac application you use the apple key for keyboard shortcut and for an X11 app you use the control key. So, for instance, if you want to copy and cut a text between, let’s say, Firefox (native) and OpenOffice (X11), you need to remember to use apple+c in Firefox and ctrl+v in OpenOffice. Needless to say it is a hassle and it makes the interoperability between native and X11 applications quite useless (did I mention I bought M$ Office on Mac for this very reason?). A first solution to solve that problem would be to switch the mapping between the ctrl and apple key inside X11, for instance using the tool xmodmap. But then we would have the disadvantage that we would need to use the apple key instead of ctrl in every situation, e.g. including within command line tools in xterm (the X11 terminal). Then, when using the command line text editor nano within xterm, we would need to press apple+o to save a text and apple+x to exit, while for nano within the non-X11 terminal, we would need to use the control key instead. So this solution appears to me as unideal. In fact, as I am not using the meta key in X11, which is originally at the place of the apple key, I can just assign the control key to the apple key and get rid of the meta. This would ensure that I can go on using the apple key for keyboard shortcuts inside X11 — e.g. apple + c in OpenOffice — while keeping the mapping of the control key for use with command line tools. This modification is pretty straightforward. Just create a .Xmodmap file inside your home folder with the following lines (or extend it accordingly if it already exists):

! ~/.Xmodmap clear Mod2 clear control keycode 63 = Control_L keycode 67 = Control_L add control = Control_L In fact, what we do here is first to clear the two logical keys corresponding to meta and control, assign Control_L to the two key we want, and recreate uniquely the control logical key. When restarting X11, your new mapping will be automatically activated. You can test it using xev or xmodmap -p.