Page 1 of 1

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

Posted: 6. Jul 2014, 00:13
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

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

Posted: 6. Jul 2014, 00:36
by loukingjr
just curious, have you tried Esc-Q?

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

Posted: 6. Jul 2014, 11:29
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.

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

Posted: 6. Jul 2014, 11:51
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.

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

Posted: 6. Jul 2014, 14:25
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. :-) )

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

Posted: 6. Jul 2014, 14:30
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.)

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

Posted: 6. Jul 2014, 14:32
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.

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

Posted: 6. Jul 2014, 15:07
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.

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

Posted: 6. Jul 2014, 22:04
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.

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

Posted: 7. Jul 2014, 01:09
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?

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

Posted: 7. Jul 2014, 08:50
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

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

Posted: 7. Jul 2014, 15:20
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.

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

Posted: 7. Jul 2014, 15:48
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.