Using the Same Keybord Layout of the Host in the Guest OS

This is for discussing general topics about how to use VirtualBox.
Post Reply
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Using the Same Keybord Layout of the Host in the Guest OS

Post by mt22 »

I'm using Virtualbox 4.1.12 on Debian x64 and my host OS is Windows XP Professional 64-bit.
On Debian I'm using a custom keyboard layout that I set on system startup through setxkbmap.
I've already successfully installed the guest addictions.
I would like to use the same keyboard layout of the host in the guest OS.
How can I do?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mpack »

That is not really a VirtualBox question, it's a question of correctly configuring Windows. You need to select the correct keyboard layout inside the guest. See the guests Control Panel, Keyboard. Other guests should have similar configuration features.

I am not promising that the correct keyboard layout is available, also note that creating custom keyboard layouts for Windows is beyond the scope of these forums.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

mpack wrote:You need to select the correct keyboard layout inside the guest. See the guests Control Panel, Keyboard. Other guests should have similar configuration features.
Are you saying that if I use a custom keyboard layout in the host is should appear somewhere in the guest configurations (Windows control panel in this case)? Or Do have I necessarily to recreate that layout on the guest?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mpack »

I'm saying that the guest has its own (virtual) keyboard, and it's own mapping from scancodes --> characters. The mapping used by the host is not relevant to the guest, any more than it would be relevant to a second physical PC. Usually however the correct mapping is dictated by the markings on the keytops, so host and guest will normally use similar though independant mappings.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

Ok, thanks for your help. So at the end I understand I have to recreate my custom layout in the guest OS... if I'm wrong correct me.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

Today I've installed a Linux guest (another Debian x64) and I noticed that the guest immediately recognized and used my custom keyboard layout... so why on Windows guests it does not happen??? ...I think this is a VirtualBox question and not an OS one, since I have different behaviors with different guests and that's strange.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mpack »

Sorry, I don't know what you are seeing, but AFAIK, what I said above is accurate.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

mpack, I wouldn't like to bother you, however I've also just tried the combination Debian x64 (host) and Fedora 17 (guest) and it worked as well... Fedora automatically detected my keyboard layout... I really don't get it, how can it be that it works fine for Linux guests and it doesn't for Windows?
Thanks for your patience.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Any and all
Contact:

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by michaln »

Linux doesn't detect the keyboard layout. You tell it what it is. So when you first installed your Linux VM, which keyboard layout did you select?
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

michaln thanks for help.
In my host OS (Debian) I use a custom version of the UK Layout (I remapped the modifiers... for example I've the CapsLock key remapped to Escape).
When I install a new Linux guest I only select the UK layout.... however all my customizations to modifier keys are automatically detected as well, in fact if I test them with the xev command and I press for example CapsLock it is actually Escape.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mpack »

Is this special keyboard? If the keyboard scancodes were configurable in hardware then its possible that a guest would be affected by the configuration. But in that case the Windows guest would have seen the same scancodes.

Did you have Guest Additions installed in all the guests you are comparing?
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Any and all
Contact:

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by michaln »

mpack wrote:Did you have Guest Additions installed in all the guests you are comparing?
Why would that make any difference? There's nothing the GAs do to keyboard input.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

mpack wrote:Did you have Guest Additions installed in all the guests you are comparing?
Thanks!!! I reinstalled the guest addictions on Windows XP and I seems like It automatically uses my layout now! Probably Something has gone wrong the first time I installed them.
mt22
Posts: 8
Joined: 18. Jun 2012, 11:32

Re: Using the Same Keybord Layout of the Host in the Guest O

Post by mt22 »

michaln wrote:
mpack wrote:Did you have Guest Additions installed in all the guests you are comparing?
Why would that make any difference? There's nothing the GAs do to keyboard input.
I don't know what GA exactly do in... but reinstalling them worked for me.

Anyway all this discussion made me doubt... if I didn't misunderstand you are saying that VirtualBox has nothing to do with keyboard layouts at all... but now my modifiers key are correctly detected on all my guests.
So is my current situation really abnormal? Or better: According to you if I press a remapped key is it not possible that now I've the same behavior in both my host and guest os? Because if so, I don't know if that's a VirtualBox bug or if it is a problem somewhere in my computer.
Post Reply