1

Environment

  • OSX 10.7.4
  • Mid-2010 iMac
  • VirtualBox 4.1.18
  • Ubuntu Precise Pangolin (all updates applied)

Issue

I have created a fresh VirtualBox vm and installed Precise from the standard desktop ISO. As a part of the install I selected the 'English UK (Mac International)' key-map. All of the keys seem to be emitting the correct character, however, for some keys a character will not be registered until I have pressed the key twice.

For example, the first time I press the ` key no character appears at the terminal prompt. However, the second time works.

This also happens for some other keys and shift combinations - ie ~ (shift + `) is also affected.

Further info

  • This does not appear to be a VM issue. I installed Precise under VMware Fusion and the exact same problem seems to occur.
  • It isn't related to the speed that I'm typing. I can press the key, wait a couple seconds, then press it again and I get the same behaviour.
  • Switching to an alternative keyboard layout (English UK extended WinKeys) the problem persists for the backtick character (you must press the § key on the keyboard). Pressing the ` key emits a character () immediately. In other words the problem seems to be related to specific characters, rather than the hardware codes emitted by particular keys.

xev output

First keypress:

KeyPress event, serial 30, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3935772, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3935884, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

Second keypress:

KeyPress event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3939630, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyPress event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3939630, (317,33), root:(320,141),
    state 0x0, keycode 0 (keysym 0x60, grave), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3939777, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

Third keypress:

KeyPress event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3956078, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
    root 0x138, subw 0x0, time 3956214, (317,33), root:(320,141),
    state 0x0, keycode 94 (keysym 0xfe50, dead_grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

The additional "grave" key press only seems to be emitted every other physical key press.

2
  • Have you tried just changing the keyboard layout to something else? Aug 12, 2012 at 11:43
  • Bruno, I have tried changing the keyboard layout and updated my question to indicate that it seems to be related to particular characters rather than physical keys.
    – johnstok
    Aug 12, 2012 at 13:04

2 Answers 2

1

It seems that the keyboard map is incorrect for these keys. The simplest solution is to make the following corrections via xmodmap:

$ xmodmap -e 'keycode 94 = grave asciitilde'
$ xmodmap -e 'keycode 48 = apostrophe quotedbl'

To have these modifications applied at login you can create a file called .Xmodmap in your home directory with the following contents:

keycode 94 = grave asciitilde
keycode 48 = apostrophe quotedbl
0

Just an addendum to Johnstok's answer. Add

keycode 94 = grave asciitilde
keycode 48 = apostrophe quotedbl

to file .Xmodmap in the home direcotory and run

xmodmap .Xmodmap

For me this did the trick, but it reverted to the old way every time I rebooted. I had to put xmodmap .Xmodmap into my .bashrc file to get it to stick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .