Support for wayland keyboard grabbing protocol

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Calin
Posts: 9
Joined: 25. Feb 2015, 08:41

Support for wayland keyboard grabbing protocol

Post by Calin »

Hi,

Currently using virtualbox with wayland, it's very annoying that the keyboard and mouse grabbing does not work. This does work with gnome boxes.

Is this planned, are the any work arounds?

Regards,
michael
Oracle Corporation
Posts: 682
Joined: 10. May 2007, 09:46
Contact:

Re: Support for wayland keyboard grabbing protocol

Post by michael »

Short answer, the Wayland people are working on this. See this bug report at Red Hat:

https://bugzilla.redhat.com/show_bug.cgi?id=1285770
thebunnyrules
Posts: 4
Joined: 24. Apr 2015, 06:15

Re: Support for wayland keyboard grabbing protocol

Post by thebunnyrules »

As a temporary/dirty workaround, you can use a script to temporarily disable the most annoying hotkeys in host and re-enable them when vbox exits. The idea:

#> disable keybindings && launch virtualbox && as soon a vbox closes (the main window, not the actual machines), re-enable the keybindings.

In Gnome, it would look something like:

gsettings set org.gnome.desktop.wm.keybindings close "['<Alt>F5']" && gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab']" && gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog "['<Alt>F3']" && gsettings set org.gnome.desktop.wm.keybindings activate-window-menu [''] && gsettings set org.gnome.mutter overlay-key "'Alt_R'" && virtualbox && gsettings set org.gnome.desktop.wm.keybindings close "['<Alt>F4']" && gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab', '<Alt>Tab']" && gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog "['<Alt>F2']" && gsettings set org.gnome.desktop.wm.keybindings activate-window-menu "['<Alt>space']" && gsettings set org.gnome.mutter overlay-key "'Super_L'"

This replaces Alt-F4 with Alt-F5 for closing, Alt-F2 with Alt-F3 for run dialog, removes Alt-Tab but leaves Super-Tab. Alt-Space is also removed. Super_L is replaced with Alt_R for overlay. vbox is launched and as long as the main vbox window is left open, this control scheme remains. As soon as that window close, the script switches everything back to the way it was before. If you have other HKs you want to disable, use dconfeditor to look at available hotkeys in org.gnome.desktop.wm.keybindings. Right click the hotkey you want to change and copy it. In terminal, type gsetting set and paste copied content after it. Put double quotes around hotkeys. Test and put into your script.

You can also find more hotkey related stuff in:

/org/gnome/settings-daemon/plugins/media-keys/
org/gnome/mutter


If you're on KDE or Cinnamon, I'm sure there is something similar you can do.

To run the script straight out of the /usr/bin dir, open a terminal:

sudo su
nano /usr/bin/vboxw #or vbw to make it even shorter
(paste script content here and use Ctrl-X to save)
chmod +x /usr/bin/vboxw
touch /usr/bin/vboxw

When you want to run it: hit Alt-F2 and enter vboxw

Like I said before, the hotkeys will revert back to normal when you close the vbox application window, meaning that you don't need to close the machines. say your running an operation in the machine/guest and want to do some stuff in your host while it's run, you can just close the app window and leave the machine running and your hotkeys will still revert to normal. When you want to go back to your machine, just launch vboxw disable the hotkeys once more.
Post Reply