M BUZZ CRAZE NEWS
// news

how to do ALT+ TAB for main system while in VBOX?

By Emma Martinez

I have recently gone through this issue. I am running Lubuntu 13.04 in VirtualBox .So when I have maximized and if I would like switch to next window of main system usually we all do ALT+TAB but thats not getting for main system and going for Vbox's Lubuntu .

So how can i get activated main system ALT+TAB functionality even i have a maximized VirtaulBox operating system .

Thank you .

7 Answers

My solution: VirtualBox: File -> Preferences -> Input -> uncheck "Auto Capture Keyboard"

5
  1. Enter into VirtualBox

  2. Press the Host key.

    • The default Host key is the right Ctrl key.
    • On macOS, the default Host key is the right Command key.
    • The previous version of this answer listed the Alt key.
  3. NowALT + TABshould work.

Regarding the Host key from VirtualBox Manual Ch. 1

To return ownership of keyboard and mouse to your host operating system, VirtualBox reserves a special key on your keyboard for itself: the "host key". By default, this is the right Control key on your keyboard; on a Mac host, the default host key is the left Command key. You can change this default in the VirtualBox Global Settings, see Section 1.15, “Global Settings”. In any case, the current setting for the host key is always displayed at the bottom right of your VM window, should you have forgotten about it

6

Two part solution:

(1) My solution: VirtualBox: File -> Preferences -> Input -> uncheck Auto Capture Keyboard (taken from @baronbaleron above)

(2) Remap Cycle through open windows to ctrl+tab. In Linux Mint (a derivative of Ubuntu): Start menu -> Keyboard -> Shortcuts -> General -> Cycle through open windows -> change binding to ctrl + tab

Because I use my left hand to do Alt+Tab, I personally set my Host key to be Left Ctrl. This makes it much more easy to switch if you have your right hand sitting on the mouse: press Left Ctrl then Alt+Tab.

2

On MacOS: (Control + ALT) then Tab

In the VM I'm using, I also have to hit Enter after this..which is slightly annoying.

This allows you to use Win+Tab on the Guest Machine, while Alt+Tab will be passed to the host. I really miss this functionality when I don't have it.

It also works with Windows Remote Desktop Connection.

Under VitualBox's menu, goto File > Preferences > Input and make sure [ ] Auto Capture Keyboard is unchecked. This can't work with it checked.

It requires AutoHotKey (or a similar scripting platform, you'll have to research syntax for that) to be ran on the Host and Guest system. You can do a similar script on just the Host, but you'd have to press Alt after each use of Win+Tab on the Guest machine to release the key-state.

This was written for a Windows 10 Host to a Windows 10 Guest, but I see no reason this can't work with other Guests. There are programs like AutoHotKey that may allow other Host OSs to do something like this.

Both scripts be run in Administrator to be able to monitor processes that are also run as Administrator.

Host Machine

Install this on the host machine as, for instance, WinTabHost.ahk.

#SingleInstance, Force
hostkey = RCTRL ; set this to your VirtualBox HOSTKEY
boxMode := ""
Hotkey, <#Tab, WinTabbing
Hotkey, >#Tab, WinTabbing
Return
TabFinish: Send, {ALT UP} RDCKeysState("Off")
Return
Tabbing: Send, {Right}
Return
WinTabbing: WinGetTitle, Title, A StringRight, TitleEnd, Title, 25 RDCKeysState("On") If (InStr(Title, "[Running] - Oracle VM VirtualBox")) { ; Guest mode Send, {%hostkey%} ; Trigger capture-state Sleep, 200 ; Sleep to give the machine time to process, just in case Send, #{TAB} ; Send Win+Tab Send, {%hostkey%} ; Release capture-state } Else If (TitleEnd = "Remote Desktop Connection") and (not Title = "Remote Desktop Connection") { ; RDC mode Send, {Alt down}{PgDn} ; Press and hold alt, and press pgdn } Else { ; Host mode Send, {ALT Down}{TAB} Sleep, 200 ; Sleep to wait a split-second for Alt-Tab window to appear iter := 0 ; loop tracker Loop { iter := iter+1 if (!WinExist("Task Switching") Or iter > 60) { ; If Alt+tab is gone, or it's been 30 seconds Send, {ALT UP} Break } Sleep, 500 } }
Return
RDCKeysState(toggle) { ; This function maps all the ways that a user might end the alt-tab box. Hotkey, Enter, TabFinish, %toggle% ; Map Enter, Click, and their alt-counterparts to TabFinish() Hotkey, !Enter, TabFinish, %toggle% Hotkey, LButton, TabFinish, %toggle% Hotkey, !LButton, TabFinish, %toggle% Hotkey, *LWIN UP, TabFinish, %toggle% Hotkey, *RWIN UP, TabFinish, %toggle% Hotkey, *Tab, Tabbing, %toggle%
}
; if you get the error 'could not close the previous instance of the script,`
; while ever trying to reload the script, you need to right click it and select
; 'Run As Administrator'

Guest Machine

Install this on the guest machine as, for instance, WinTabGuest.ahk.

#SingleInstance, Force
SetWorkingDir %A_ScriptDir%
if (not A_IsAdmin) { Run *RunAs "%A_ScriptFullPath%" ; Run as administrator to detect keystrokes focued on Elevated Programs
}
Hotkey, <#Tab, WinTabbing
Return
TabFinish: Tooltip, TabOut Send, {ALT UP} RDCKeysState("Off")
Return
Tabbing: Send, {Right}
Return
WinTabbing: Send {Alt DOWN}{TAB} RDCKeysState("On") Sleep, 200 iter := 0 Loop { iter := iter+1 Sleep, 200 if (!WinExist("Task Switching") Or iter >= 60) { Send, {ALT UP} Break } Sleep, 500 }
Return
RDCKeysState(toggle) { Hotkey, Enter, TabFinish, %toggle% Hotkey, !Enter, TabFinish, %toggle% Hotkey, LButton, TabFinish, %toggle% Hotkey, !LButton, TabFinish, %toggle% Hotkey, *LWIN UP, TabFinish, %toggle% Hotkey, *RWIN UP, TabFinish, %toggle% Hotkey, *Tab, Tabbing, %toggle%
}

Pressing the Host key once before pressing the Alt + Tab combination seems to work for many. In case it doesn't work for you, try pressing it twice instead.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy