Welcome to the
Ubuntu community! See my note about this at the end.
Note:As this is my most popular blog entry, it looks like a lot of people are suffering the same problem. I'm grateful for all the positive feedback - thanks! Feel free to continue to leave feedback, especially if you have more information (or something that doesn't work), or links to related pages. Thanks :)For what seems like 300 years I've been struggling with the horrible effect of VMWare workstation on my keyboard. I have a perfectly good license for VMWare workstation 4, so I continued to use it regardless of the fact that version 6 is available. (I've since upgraded to version 6, and from the responses from others this fix still works).
This never used to be a problem, but it got successively worse: Once VMWare grabbed the keyboard, many function keys (ctrl, shift, alt, etc) would remap to nothing, or worse, some other key function!
Solution 1I solved this out-side of vmware thanks to a gentoo-user thread:
- Run `setxkbmap` from your terminal
(Ubuntu: install x11-xkb-utils; Gentoo: install x11-apps/setxkbmap). This fixes some keys, but not all - Then put your cursor over the VMWare menu bar somewhere, but not in the client window
(don't let the keyboard/mouse get grabbed automatically) - Press Ctrl-g
(this grabs the keyboard/mouse). You should see the cursor jump to the middle of the VMWare screen. If this doesn't work, focus a different window, and try again. - Press Ctrl-Alt
(This un-grabs the keyboard/mouse)
This solved the problem outside VMWare (on the host), but still didn't solve the problem where within VMWare (on the guest), my arrow keys, del and ins, etc. were still screwed. For a keyboard-shortcut lover such as myself, who uses the keyboard more than the mouse, this is very annoying.
Finally I thought I'd try VMPlayer (and wow, does the suspend / resume feature work fast!). The problem was even more evident - now every use of VMWare many non alpha-numeric keys were unusable.
Solution 3:
(no, you didn't miss the 2!)Some readers have had success with the one line:
xkeymap.nokeycodeMap = true
in the file /etc/vmware/config. As the root user (
sudo won't work in this case), this command should do it for you:
echo "xkeymap.nokeycodeMap = true" >> /etc/vmware/config
or:
echo "xkeymap.nokeycodeMap = true" >> ~/.vmware/config
If you don't have root access. See Solution 2 for more locations of this config file.
Solution 2:
This is the original Solution 2, and since many comments reference it I have left it numbered so. However, Solution 3 is much simpler (and newer) so I've put that first.
Apparently this issue arrises with the evdev input driver. Thanks to
"doranikov", The solution is simple: Tell VMWare what your keyboard really does! Put this in either /etc/vmware/config, or /usr/lib/vmware/config if you have root access, or in ~/.vmware/config otherwise. (Do this in the
host OS, not the client) If the file doesn't exist, just create it:
xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu
done!
Getting keycodesWhat if your keycodes are different? To get the keycodes, you'll need xev or xmodmap. Run xev and place your cursor in the xev window. Then press the key you want (eg, right Control).
You'll get output like this on the terminal:
KeyPress event, serial 33, synthetic NO, window 0x3200001,
root 0x1cb, subw 0x0, time 749698, (167,181), root:(1793,706),
state 0x10, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 33, synthetic NO, window 0x3200001,
root 0x1cb, subw 0x0, time 749810, (167,181), root:(1793,706),
state 0x14, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Look at the value after keycode. In this case 105. Change the xkeymap.keycode.
to 105:
xkeymap.keycode.105 = 0x11d # Control_R
0x11d is the scan code.
For xmodmap, use:
xmodmap -pk
Further help:
Where'd you come from?P.S. hello to all the
planet larry readers, and the Ubuntu community. Thanks to you guys (and some great linking from other bloggers, VMWare forums, etc) I now have over 1000 hits a month! In November 2008, I got over 6500 hits! blog on!