问题描述
我的NX会话的键盘映射出现乱码.
I have issues with the keymap of my NX session being garbled.
我有一台运行OS X Lion的Macbook Air.我使用OpenNX与运行FreeNX的Ubuntu服务器开始会话.会话类型为Gnome.
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.
我的键盘映射非常不正确(例如w给出=,delete给出,",t给出w).我试过了:
My keymap is very off (eg. w gives =, delete gives ",", t gives w). I tried:
xmodmap -pke > nxclient.xmodmap
在客户端上,
xmodmap nxclient.xmodmap
在服务器上,我恢复了很多密钥,但是仍然无法使用.我尝试了Gnome键盘布局,但是没有一个奏效. XFCE会话也会发生此问题.
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.
任何提示,我将不胜感激. x2go可以使用Gnome在客户端和服务器上正常工作.不幸的是,它当前不适用于Mac OS X Lion.
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.
推荐答案
我想提供一个完整的实用解决方案.我在某些 Fedora FC20 机器上遇到了相同的问题.这是复制和粘贴工作的完整方法.
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
是您的用户名,可以使用ssh远程连接到您需要在其上运行x2go
的计算机,而machine
是该计算机的主机名.
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.
注意:如果您在目标计算机上具有自定义键映射,则它们往往会与x2go
混为一谈.为了完成这项工作,我需要重设键盘映射并设置裸露的英语(美国).我使用的是带有死键的国际英语(美国),它不能正常工作...
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...
-
在本地计算机(客户端计算机)上使用
xmodmap
创建键盘映射定义文件, XQuartz对于使此命令可用可能是必需的.顺便说一句,也有必要使用x2go
.
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 usex2go
by the way.
xmodmap -pke > osx-keymap
如果未找到xmodmap
,则表示它不在PATH
中,如果您安装了XQuartz,则应将命令放置在/usr/X11/bin/xmodmap
中,因此不要仅在整个路径中使用xmodmap
作为前缀.
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.
在文件上添加一些修饰符(例如 ato 答案)
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
将文件加载到计算机上(username
是您在计算机上登录的用户名.更改它!)
Load the file on the machine (username
is your username to login on the machines. Change it!)
scp osx-keymap username@machine:~/.Xmodmap
在桌面上创建一个脚本,如果键盘不起作用,可以仅使用鼠标运行该脚本
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
连接x2go
.基本上应该可以.
Connect with x2go
. Basically it should work.
如果仍然无法正常运行,请尝试:
If it still does not work try to:
- 断开并重新连接
x2go
- 用鼠标单击桌面上的
run_keyboard.sh
,然后选择运行. - 和以前一样,但是然后断开连接并与
x2go
重新连接 - 不幸的是,这不是一个完整的解决方案.据报道某些计算机无法使用
- 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
这篇关于从Mac OS X Lion到Ubuntu的NX键盘映射问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!