Keys with alternate characters not working in Unity mode

I'm running VMware Player 2.5.2 build-156735 on Windows XP SP3.

My guest is CentOS 5.3, with VMware Tools 7429-156735.i386 installed.

Everything is working fine, except for a minor but irritating problem: when I switch to Unity mode, the alternate characters of my Spanish keyboards (those that are selected by pressing simultaneously the <Alt Gr> key and the main key) don't work. The same key strokes work fine when NOT in Unity mode. For instance, pressing <Alt Gr> and <3> does nothing in Unity mode, but outputs "#"in normal mode.

As these characters are essential for me (these characters are \, @, #, , {, } and ¬) I have to work without Unity, which is a pity, because I love it.

Is there any workaround available out there?

Tags (3)
0 Kudos
5 Replies

The same with me,

Guest OS: OpenSuse 11.2

Host: Windows 7 32 bits

0 Kudos

Keyboard handling works a bit differently in unity. You'll get the best results if you set the guest's keyboard layout to the same as the host's. Or if there isn't an identical layout in the guest, use a layout where AltGr and the characters @ # (and so on) are on the same physical keys.

0 Kudos

The guest keyboard is correctly set (spanish, catalan variation with middle-dot). When running normally (i.e. without unity activated) keyboard works fine, just in unity mode such keys don't work.

0 Kudos


After much searching I have not found an elegant solution to the problem. Nevertheless, I managed to apply a solution.
For special characters that do not work in Linux guest systems can be used with appropriate attribution trick behavior of the keyboard.

We have the host system Windows Vista or Windows 7 32/64 bit and any guest OS such as ubuntu, slackware or openSuSE.

* In the host system install the program AutoHotKey: http://www.autohotkey.com/ using a standard installation (download and double click).
* In the guest OS install the program: Autokey: http://code.google.com/p/autokey/ eg via apt-get install autokey autokey-gtk   or compile from sources if you prefer.

Suppose you want to get the Polish letters: ą and Ą (alt + a or alt + A).

--- HOST CONFIGURATION -----------------------------------------------------------------------------

Create a script on the host such myLetters.ahk. Here is a sample:

#ifWinActive ahk_class VMwareUnityHostWndClass
^!a::Send _01_
^!+a::Send _02_

^!a means that when you press alt and ctrl and the letter a will be sent string: _01_;
^!+A means the same thing but with the shift key, which is a large letter  (sends string _02_).

Quoted strings _01_ and _02_ are of course only example. Use those for which you are sure that they will not appear in your written texts on a daily basis (browsers, editors, etc.).

You may ask why we add to the shortcut <ctrl>. I checked that when you press alt-a combination then unity window adds the control key too.
This must be taken into account here so that linux guests can properly capture keyboard.

# ifWinActive ahk_class VMwareUnityHostWndClass - specifies that the push buttons are to be active only if window unity application is active.
The rest of the application (ie those from the host) gets the standard characters, of course, ą and Ą instead of strings _01_ or _02_.

To run script myLetters.ahk just double click it. In the tray you should see AutoHotKey icon and windows starts capture <alt a> and  <alt A> combinations.

--- GUEST CONFIGURATION ----------------------------------------------------------------------------

In the guest system run the program Autokey and add a new phrase.

In my example for the letter ą:

* set option "Paste using"  to  "Clipboard (Shift + Insert)"

* Abbreviation for "_01_" (dialog window on Set pressed):

Abbreviation: _01_

Trigger on: Default
Remove typed abbreviation: enabled
Trigger When I typed abbreviation: enabled
Trigger Immediately (do not require a trigger character): enabled

* In the text area above write letter you want to appear as a _01_ string replacement (in my case 'ą').

* In the general options (edit-> preferences) disable the option "Enable pressing backspace to undo".

Of course, the whole issue needs to be developed, eg:
- the frequency of typing in the guest OS;
- omission AutoHotKey unity windows host to the guest of windows, where the keyboard is captured correctly;
- autoreplace when pasting texts.

I suggest you read the documentation AutoHotKey and wish you success.

I use those solutions successfully and can help you in case of problems.

Yours sincerely.

Edit: I forgot about guest apps like gnome terminal - they should be excluded in autokey filter. Try it yourself - option "Window Filter" when you can select names of windows.

0 Kudos

Hello again.

I  decided to explore more about the problem with special characters in  unity mode and developed a more elegant solution than the first one.

The scenario is the same:

* We have a host system Windows (eg. Vista or 7);

* Guest system is Linux (eg. Ubuntu or SuSe);

* When the guest OS is running in unity mode, certain special characters  are not generated. Our task is to circumvent this problem.


1. In host system install autohotkey application and create simple script (name can be eg. keys.ahk):

  #SingleInstance force

  #ifWinActive ahk_class VMwareUnityHostWndClass

   This script will make any press <Right Alt> key will be translated into pressing the <Menu> key.

   It only works in every unity window (VMwareUnityHostWndClass).

2. Run that script (eg. by clicking right mouse and select: Open with AutoHotkey_L).

3. Run unity mode your linux guest OS.

4. In guest system run terminal, navigate to your home directory (If you're not there) and write:

  xmodmap -pke > .xmodmap

The above command will save the current X keyboard map to a file .xmodmap.

5. In the terminal run xev (program), press <Menu> key and find related keycode.
    Usually this information is located in the third line of the generated message.
    Here is an example for the key <n> (where keycode is 57):

     KeyPress event, serial 34, synthetic NO, window 0x4200001,
   root 0x102, subw 0x0, time 1577765, (310,543), root:(1653,625),
   state 0x10, keycode 57 (keysym 0x6e, n), same_screen YES,
   XLookupString gives 1 bytes: (6e) "n"
   XmbLookupString gives 1 bytes: (6e) "n"
   XFilterEvent returns: False

6. If you already have the <Menu> keycode, edit. xmodmap file
    and find line where this code exists.
    In Ubuntu 10.10 installed on VMware workstation 7.1 there is a row:

  keycode 135 = Menu NoSymbol Menu.

  Change this line to:

  keycode 135 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

  Save file and exit.

7. When you reboot yout guest OS (or just logout and login again) Ubuntu will ask you what keymap file to use.
    It is a popup window, so choose your .xmodmap file and accept it.

8. From now on, in guest OS every keystroke <Menu> will work if the <Right Alt> key has been pressed .
    In contrast, in the host OS, the autohotkey script turns every <Right Alt> to <Menu>.
    This way, when we want write special character (eg. polish letter ą), host does not send to unity window
    combination of keys (<Left Control> and < ISO_Level3_Shift> and <a>), wchich are unrecognizable in guest
   - host sends just <Menu> key.
    Of course, instead of the <Menu> key you can remap another rarely used or one that has no special meaning for you.

Note !

If the guest OS is Windows then the above treatments will make the special characters will not work properly there.
The workaround is to install in guest OS autohotkey program and remap <Right Alt> back.
Just try this script (run it of course - yes, its true - now you have two autohotkeys running - one in host and one in guest Smiley Happy ) :

#SingleInstance force

Autohotkey scripts should be move to autostart of course to run when OS'es starts.

Have a nice day.


0 Kudos