Sending key combinations to the host when the guest has captured the keyboard

This is for discussing general topics about how to use VirtualBox.
Post Reply
GregL
Posts: 1
Joined: 25. Sep 2017, 19:41
Primary OS: MS Windows other
VBox Version: OSE other
Guest OSses: Various Linux, Windows
Location: Denver, Colorado

Sending key combinations to the host when the guest has captured the keyboard

Post by GregL »

tl;dr I need to know how to configure a user-defined set of keyboard combinations that are sent to the host when the guest has captured the keyboard.

I found a thread which is a perfect match to my question (the first and only topic I could find), but it is very old: topic 30105 "Leaving certain key presses to the Host OS." I am posting here instead of in "Virtual Box on Windows Hosts" because I believe the same issue exists on all host OSes.

I need to know how I can define a set of key combinations that are sent to the Host OS when the Guest OS has captured the keyboard. It would seem that only the keys in the Input > Keyboard > "Insert <key>" menu items are sent to the Host OS. How do I tell VirtualBox that I want other key combinations sent to the Host OS?

My biggest concern at the moment is workspace switching. I have one maximized VM per workspace. I would like to be able to use the host keyboard shortcuts for switching workspaces.

Say I have a Mac host and decide I want to define Ctrl+1 as "Switch to Desktop 1," then I need a way for Ctrl+1 to go to the Mac host rather than the guest.

I found a work-around for workspace switching on my Windows host: 1) I unchecked "Auto Capture Keyboard" in Preferences > Input, and 2) I made the "Windows Logo Key" key the "Host Key Combination" in Input > Virtual Machine. Since Windows Logo Key+Ctrl+arrow is the workspace switcher shortcut, and as long as I hit the Windows Logo Key *first* when assembling that key combination, then the Guest releases the keyboard just in time for the windows host to receive the shortcut. This works for any windows host shortcut than includes the Windows Logo Key. It also works for the various media, sleep, and other special keys on my keyboard. The fact that the keyboard is not auto-captured by the guest is a non-issue because I invariably click into some part of the guest before typing anything.

However, there is a huge problem with this. It effectively disables all VirtualBox shortcuts! The Input > Virtual Machine > Shortcuts seem to be limited to Host + <key> combinations. With my Host key set to Windows Logo Key, then no vbox shortcuts ever make it to the Guest VM. For example, I had mapped Host + M to "Show Menu." When I hit Host (Windows Logo Key) + M, all of my host OS windows disappeared! This was quite distressing until I realized that the host OS behavior for Windows Logo Key + M is "Minimize all windows." Another example, Host + Home is the default vbox mapping for the Popup Menu. When I hit the Host (Windows Logo Key) + Home key combination, I get the Windows host shortcut behavior instead, which is "Minimize all except the active desktop window."

That's a lot to say about a Windows host, but again, the issue is with all host OSes. Linux OS window managers typically support multiple workspaces with keyboard shortcuts. There is no way to get those shortcuts to the linux host either. Windows just happens to have a workaround, albeit ugly.

In summary, I need to know how to configure a user-defined set of keyboard combinations that are sent to the host when the guest has captured the keyboard. If this is not possible, then please tell me how to enter an enhancement request.

Thanks!
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Sending key combinations to the host when the guest has captured the keyboard

Post by Martin »

Virtualbox doesn't have such a feature which would need to send all keystrokes through a configurable filter.
But in the past the standard answer to this question was an easy workaround: Just press the host key once and then use normal key combination to switch workplaces.
Post Reply