开发者

Keymap issues with NX from Mac OS X Lion to Ubuntu

开发者 https://www.devze.com 2023-03-27 11:20 出处:网络
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.

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.


I found a surprisingly simple solution: disconnect the X2Go session and reconnect. This fixes the Mac keyboard issue for me (which seems to persist beyond OS X Lion).


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


Append this to the end of your nxclient.xmodmap generated by xmodmap -pke to get a usable layout:

!
! 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


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


What has worked for me has been going to the system menu -> keyboard -> Layouts tab -> keyboard model -> apple -> Macintosh old. However, there are issues. I can't seem to use Control+C, Control+V, or the arrow keys. If your arrow keys do work I would be grateful if you told me what your .nxs keyboard options look like.


We had the same problem, though running xfce, which is similiar to gnome2 though. I just found a solution (running Mac OSX 10.9.1):

  • Download the newest x2go client (4.0.1.3 at time of posting)
  • Setup your x2go-session to "automatically detect keyboard settings"
  • Connect and realize that e.g. tabulator is only working when you are additionally pressing the control key.
  • Solution: Edit the keyboard shortcuts in "~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml" (on the server) and delete the entry which is set up to "Super + Tab"
  • Enjoy your functional keyboard

Credits go to goofrider.


Try to change your Shell from tcsh to bash. Tcsh cause keyboard problem.


You can simply fix by changing one setting in Xquarts. To fix:

  1. Open Xquarts
  2. Go to preferences
  3. Check follow system keyboard layout.
  4. Done!

Keymap issues with NX from Mac OS X Lion to Ubuntu

0

精彩评论

暂无评论...
验证码 换一张
取 消