Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keymap issues with NX from Mac OS X Lion to Ubuntu

I have issues with the keymap of my NX session being garbled.

I have a Macbook Air running OS X Lion. I use OpenNX to start a session with an Ubuntu server running FreeNX. The session type is Gnome.

My keymap is very off (eg. w gives =, delete gives ",", t gives w). I tried:

xmodmap -pke > nxclient.xmodmap

on the client and,

xmodmap nxclient.xmodmap

on the server and I recover many of my keys, but it is still unusable. I tried the Gnome keyboard layouts but none worked. The problem also occurs with an XFCE session.

I would appreciate any tips. x2go worked on client and server using Gnome with no issues. Unfortunately, it does not work on Mac OS X Lion currently.

like image 707
Paul Avatar asked Aug 10 '11 22:08

Paul


2 Answers

This answer was given by @Simon in the comments of the question and works for me (x2go / Xquartz):

On OSX do:

xmodmap -pke > keymap-x2go-osx.xmodmap
echo "xmodmap ~/keymap-x2go-osx.xmodmap" > x2go-xinit

Edit keymap-x2go-osx.xmodmap and add modifier reset from @ato’s answer, then copy it to the VM:

scp keymap-x2go-osx.xmodmap -P your_port your_ip:/home/your_user/
scp x2go-xinit -P your_port your_ip:/home/your_user/.xinit
like image 174
Hraban Avatar answered Sep 22 '22 17:09

Hraban


I wanted to provide a complete practical solution. I was experiencing the same problem on some Fedora FC20 machines. That's the complete how-to that should work copying and pasting.

username is your username to connect remotely using ssh to the machine you need to run x2go on and machine is the hostname of that machine.

NOTE: If you have custom keymappings on the target machine they tend to mess up with x2go. To make this work I needed to reset the keymappings and set a bare English (US). I was using International English (US) with Dead keys and it was not working...

Has been tested on Mac Book Pro Mid 2010, 2011 and 2013. New Retina machines seem to not be affected by this bug.

  1. Create a keymap definition file using xmodmap on your local machine (the client machine), XQuartz might be necessary for having this command available. It's also necessary to use x2go by the way.

    xmodmap -pke > osx-keymap
    

    If xmodmap is not found that means it's not in the PATH, if you installed XQuartz the command should be placed in /usr/X11/bin/xmodmap so instead of using just xmodmap prepend to it the full path.

  2. Append some modifiers to the file (as from the ato answer)

    echo '! Now reset all the modifiers too
    !
    clear shift
    clear lock
    clear control
    clear mod1
    clear mod2
    clear mod3
    clear mod4
    clear mod5
    add shift = Shift_L Shift_R
    add lock = Caps_Lock
    add control = Control_L Control_R
    add mod1 = Alt_L Alt_R
    add mod2 = Meta_L Meta_R' >> osx-keymap
    
  3. Load the file on the machine (username is your username to login on the machines. Change it!)

    scp osx-keymap username@machine:~/.Xmodmap 
    
  4. Create a script on the Desktop that can be run just using the mouse if the keyboard does not work

    ssh username@machine <<"STR"
    echo '#/usr/bin/env bash
    xmodmap ~/.Xmodmap;'>~/Desktop/fix_keyboard.sh; chmod +x ~/Desktop/fix_keyboard.sh
    STR
    
  5. Connect with x2go. Basically it should work.

If it still does not work try to:

  • disconnect and reconnect with x2go
  • click on the run_keyboard.sh on the desktop with the mouse and select Run.
  • as before but then disconnect and reconnect with x2go
  • Unfortunately is not a complete solution. Some computers are reported to not work with it
like image 25
rdbisme Avatar answered Sep 23 '22 17:09

rdbisme