Hi, i'd like to define custom keyboard shortcuts so that when i press some key combination (eg Alt + G) it would behave as if my guest OS has captured Alt + Tab. Is it possible?
Edit.: Capturing Alt + Tag from guest os instead of host os would also be an acceptable solution.
Host: Debian 10
Guest: Windows 10
VirtualBox: 6.1.6 r137129 (Qt5.11.3) (I'm willing to update that one if that helps)
Defining custom keyboard shortcuts
-
- Site Moderator
- Posts: 20965
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: Defining custom keyboard shortcuts
You could inspect the list of available commands in the main Virtualbox window's File menu, Preferences, Input to see if something might work for you. But to the best of my knowledge, if the host OS grabs a certain key combo, it does so before Virtualbox could get the combo. So no way to pass Alt-Tab if Alt-Tab is grabbed by the host OS first.
However, there is a vboxmanage command to pass keyboard scan codes into a VM:
vboxmanage controlvm "vm name" keyboardputscancode <hex> ....
which can put key movements into the VM. So you might be able to send 'alt down' 'tab down' 'tab up' 'alt up' codes to the VM. These won't get caught by the host OS (I think) and the command can be launched by a batch file or script that can be started with a custom host OS keyboard shortcut.
However, there is a vboxmanage command to pass keyboard scan codes into a VM:
vboxmanage controlvm "vm name" keyboardputscancode <hex> ....
which can put key movements into the VM. So you might be able to send 'alt down' 'tab down' 'tab up' 'alt up' codes to the VM. These won't get caught by the host OS (I think) and the command can be launched by a batch file or script that can be started with a custom host OS keyboard shortcut.
Re: Defining custom keyboard shortcuts
Thanks, this surely can be very useful command, but after a while of playing with it i've realized that i can use "Ctrl + Alt + Tab" which is close enough to what i need and even though it's also in use by default in gnome, it can be remapped.scottgus1 wrote:You could inspect the list of available commands in the main Virtualbox window's File menu, Preferences, Input to see if something might work for you. But to the best of my knowledge, if the host OS grabs a certain key combo, it does so before Virtualbox could get the combo. So no way to pass Alt-Tab if Alt-Tab is grabbed by the host OS first.
However, there is a vboxmanage command to pass keyboard scan codes into a VM:
vboxmanage controlvm "vm name" keyboardputscancode <hex> ....
which can put key movements into the VM. So you might be able to send 'alt down' 'tab down' 'tab up' 'alt up' codes to the VM. These won't get caught by the host OS (I think) and the command can be launched by a batch file or script that can be started with a custom host OS keyboard shortcut.
Anyway, for the future lurkers, other useful usage of this command would be Alt + F4
Code: Select all
# (left alt key press; F4 key press; left alt key down; F4 key down
vboxmanage controlvm "vm name" keyboardputscancode 38 3e b8 be
-
- Site Moderator
- Posts: 20965
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: Defining custom keyboard shortcuts
Great, thanks for telling us your solution!