Fixing a wrong Keymap in FreeNX-Sessions
- October 30th, 2010
- Posted in Linux
- By Mr. Nerd
- Write comment
Using a FreeNX server, I encountered a problem with a wrong keymap being used within the FreeNX session, which results in certain characters not working. Especially annoying: The AltGr key, on my system, was interpreted as “Enter”.
In order to fix this problem, one needs to export the xmodmap from the client system (running the NX client) to the server and, afterwards, setting this xmodmap from within the session. Of course, this can also be automated.
First of all, you need to export the xmodmap of the client you’re connecting from:
xmodmap -pke > nxclient.xmodmap
Now you need to transfer it to the system you’re using as the server. Afterwards, whenever you start a NX session, you need to call the following command from within the session (assuming you put the file obtained above in your home directory):
xmodmap ~/nxclient.xmodmap
Of course, you can automate this by calling the command from within the .profile file. The following code only makes sense though, when you connect from clients which all use the same keymap:
if [ -n "$NXSESSIONID" ]; then /usr/bin/xmodmap ~/nxclient.xmodmap fi
This snippet works by checking for the environment variable $NXSESSIONID, which indicates that the session is running from within NX.