NX, OSX and the ALT key

In OSX the ALT is mapped to Option. When running a X11 application like the !M NX client, things like ALT-TAB, or ALT-MENU wont work unless you add the following to dot-Xmodmap.

Basic method:

keycode 66 = Alt_L
clear Mod1
add Mod1 = Alt_L Alt_R

More complicated method:

! Make the Alt/Option key be Alt_L instead of Mode_switch
keycode 66 = Alt_L

! Make Meta_L be a Mod4 and get rid of Mod2
clear mod2
clear mod4
add mod4 = Meta_L

! Make Alt_L be a Mod1
clear mod1
add mod1 = Alt_L

In order to get this to load automatically, you need to to add something to dot-xinitrc or similar. I still haven’t comfirmed the exact details for this. The more complicate method link about also has a discussion about Customizing Fullscreen X11 on Mac OS X. There also some useful tips about keyboards and mice at these two sites. This guy is also running a similar setup with OSX and FreeNX. I think I probably need a larger screen, as well, to improve the combined Ubuntu-NX/OSX experience. 😉


  1. @jdotk Said,

    March 16, 2010 @ 9:15 pm

    Just wanted to say thanks very much for this. I'm using NX in OS X to a Linux server and couldn't figure out how to get the Alt keys to work. This works beautifully! Thank you for sharing! =:)

  2. John B Said,

    September 7, 2010 @ 2:45 pm

    Thank you, thank you, thank you, thank you… You have no idea how much searching I've done. The first method works wonders!


  3. Plecto Said,

    January 14, 2012 @ 9:30 pm

    Thanks for your post. It works fine for me too (I conntect to Ubuntu 11.10 through NX from Mac OS X 10.5.8), except for the space key. To write a space in Ubuntu I need to use SHIFT+SPACE on my Mac keyboard.
    Any idea of what is messed up in my configuration?

RSS feed for comments on this post