Sync keyboard layout switch between guest and host in seamless mode
Sync keyboard layout switch between guest and host in seamless mode
I try to use VirtualBox in seamless mode to run browser inside guest. Both host and guest systems are running on ubuntu 17.04 (unity in host, xfce in guest) and all work fine except switching between keyboard layouts. Of course, I've disable auto capture of keyboard in guest (because I need hosts keybindings). And now then I press Alt+Shift inside browser - keyboard layout changed in host system, not in guest. So I continue to write in same language. How to fix it? I need any ability to change keyboard layout in seamless mode.
-
socratis
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: Sync keyboard layout switch between guest and host in seamless mode
As far as I know, keyboard doesn't change differently in seamless compared to everything else. What might be confusing is who has the focus at the time that you switch the layout, the guest or the host. You got to be really careful with that part. I'm keeping the layout switching different on the host and on the guest personally...Malamut wrote:I need any ability to change keyboard layout in seamless mode.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Re: Sync keyboard layout switch between guest and host in seamless mode
Well, I've 'solve' this problem with very durty hack: I've write script fo host system and add standard Alt+Shift hotkey to launch it:
This is not a good solution, but it's work. If anybody know a good way to solve the problem - would be grateful.
Code: Select all
current=$(gsettings get org.gnome.desktop.input-sources current | sed -E "s/^uint32\s+//")
[ "$current" == '0' -o "$current" == '1' ] || exit 0
new=$(((current+1)%2))
gsettings set org.gnome.desktop.input-sources current $new
xkbmap='us+ru:2'
case "$new" in
0) xkbmap='ru+us:2' ;;
1) xkbmap='us+ru:2' ;;
esac
VM=aa-bb
user=user
pass=passwd
if vboxmanage list runningvms | grep -q $VM; then
vboxmanage guestcontrol a002b8aa-16b3-4b5d-be4c-3f221d66f5f3 --username "$user" --password "$pass" run -E PATH=$PATH -E DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS -E XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -E DISPLAY=:0.0 -- /bin/bash -c "gsettings set org.gnome.desktop.input-sources current $new; setxkbmap $xkbmap"
fi