guest OS can't see command-q (ticket 4208)

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
rcobbe
Posts: 5
Joined: 5. Jul 2014, 23:58

guest OS can't see command-q (ticket 4208)

Post by rcobbe »

This is obviously a known problem (see ticket #4208), but it seems that VirtualBox intercepts Cmd-Q and Cmd-H, preventing the guest OS from seeing these keypresses. This happens both in full-screen mode and in windowed mode, and it's completely independent of the host key setting. For example, I have my host key set to right-control, but hitting cmd-Q does the same thing as hitting right-control-Q. I'd really really like it if cmd-Q got passed through to the guest OS, so that I could use Meta-Q in Emacs (which I do a lot). Making this behavior configurable would be fine with me, too.

The ticket that I cited above has been open for 5 years without seeing much action, and the only suggested workaround doesn't actually work. Does anyone know if there's any action planned on this point? Or, alternatively, is there a good way for me to advocate among the developers for prioritizing this issue more highly?

Thanks,

rcobbe
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

just curious, have you tried Esc-Q?
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
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: guest OS can't see command-q (ticket 4208)

Post by socratis »

Esq-Q does zilch on my side, host or guest (OSX on OSX). Is it working on yours?

The only thing that is consistently working is if you click on the title bar of the guest. Then Cmd-Q, Cmd-H is correctly passed to the guest. In any other case it is intercepted by the host.
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.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

actually I didn't try. I was trying to see if esc-q is passed to emacs in a guest. I wasn't going to install it just to see. it's supposed to be the alternative to Meta-Q. I assume the OP was inside the guest when he tried Meta-Q.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
rcobbe
Posts: 5
Joined: 5. Jul 2014, 23:58

Re: guest OS can't see command-q (ticket 4208)

Post by rcobbe »

loukingjr wrote:just curious, have you tried Esc-Q?
I have (in Emacs, of course), and it works fine. But I would strongly prefer to be able to use the Meta key (by which I mean the plastic bump immediately to the left of the spacebar), because that's what works on every other computer I've ever run Emacs on, and it's in really deep muscle memory. So when I go to run fill-paragraph, my instinct is to hit cmd-q, and I get the VirtualBox close-VM operation instead, which is really distracting.

(You may conclude from the above that I've not tried to run Emacs on Windows, because the OS uses the plastic bump immediately to the left of the space bar for something else. You would be correct. :-) )
rcobbe
Posts: 5
Joined: 5. Jul 2014, 23:58

Re: guest OS can't see command-q (ticket 4208)

Post by rcobbe »

socratis wrote:Esq-Q does zilch on my side, host or guest (OSX on OSX). Is it working on yours?

The only thing that is consistently working is if you click on the title bar of the guest. Then Cmd-Q, Cmd-H is correctly passed to the guest. In any other case it is intercepted by the host.
That doesn't seem to work for me. Normally, I'm running in full-screen mode, so there isn't a title-bar to click on, but if I temporarily drop back to windowed mode, clicking on the title bar doesn't have any real effect. Whether I switch from, say, the Finder to the virtual machine via cmd-tab, by clicking on the title bar, or by clicking in the window itself, cmd-Q still causes VBox to try to close the VM.

(Esc Q is an alternative way to generate Meta-Q in emacs; I wouldn't expect it to work in most other guest applications.)
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

It doesn't help anything that Mac keyboards are mapped differently. I have noticed your issue though. Even when you remap the HOST key VirtualBox seems to remember the old setting. I guess you aren't so much changing the host key as you are adding a second. Maybe if you start a new ticket it would help.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

What I think after playing with changing keys in the VirtualBox input settings is that for Mac hosts anyway, the Mac is actually intercepting Cmd-Q before it ever gets to VirtualBox so changing it won't do anything. I also noticed when I changed the Host/Meta key to right-control for the VMs, and tried changing cmd-Q to option-Q in the host settings, it really did a job trying to type inside one of my guests. Needless to say, I changed them back.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
rcobbe
Posts: 5
Joined: 5. Jul 2014, 23:58

Re: guest OS can't see command-q (ticket 4208)

Post by rcobbe »

loukingjr wrote:What I think after playing with changing keys in the VirtualBox input settings is that for Mac hosts anyway, the Mac is actually intercepting Cmd-Q before it ever gets to VirtualBox so changing it won't do anything. I also noticed when I changed the Host/Meta key to right-control for the VMs, and tried changing cmd-Q to option-Q in the host settings, it really did a job trying to type inside one of my guests. Needless to say, I changed them back.
That's my guess as well, yeah -- inspired by the fact that cmd-q, cmd-h, and cmd-opt-h show up as accelerators in the VirtualBox VM menu (that's the host menu bar, not the guest). That said, it is possible to have keyboard accelerators listed in menus even when they don't actually do anything when you type them. In particular, in Apple's X server (specifically XQuartz 2.7.6), I've got the "Enable key equivalents under X11" option disabled, so Cmd-Q et al are passed through to clients, even though they still appear in the menus.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

I'm sure that it would be possible to have an option to disable certain keyboard commands in VirtualBox. The problem as I see it would be how much incentive would the Oracle developers have to implement such a feature given the small user base who desire such a feature?
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

I don't know if you've seen this page but there is some info on how to disable shortcuts for OSX.
Disable Shortcuts
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
rcobbe
Posts: 5
Joined: 5. Jul 2014, 23:58

Re: guest OS can't see command-q (ticket 4208)

Post by rcobbe »

loukingjr wrote:I don't know if you've seen this page but there is some info on how to disable shortcuts for OSX.
Disable Shortcuts
I hadn't seen that; thanks for the link! As it happens, I already use BetterTouchTool so that I can get the Apple Magic Trackpad to generate a middle click. Unfortunately, using this to disable Cmd-Q et al for VirtualBox (or VirtualBoxVM, which appears to be the application that actually runs the VM) doesn't have any effect. And in fact it's hard to even get the options to stick in the BetterTouchTool window; they keep getting erased. Definitely worth a try, though -- thanks!

This may suggest that the problem isn't as simple as OSX intercepting the keybinding before the app gets it, but I've definitely reached the limits of my understanding of how this stuff works on MacOS.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: guest OS can't see command-q (ticket 4208)

Post by loukingjr »

You're welcome. It's definitely possible to globally disable cmd-q but you would have to do it every time you ran VirtualBox and re-enable it when you were done. sounds like a pain. One thing that might work without having to hack OSX, if you have a spare USB keyboard, create a USB filter for your guest to capture the second keyboard. You would have to start your guest before you plugged in the keyboard but it may work. I think when you use filters for guests the Mac doesn't see the device at all... maybe

Personally? I would get used to using esc-Q.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Post Reply