Tabs Outliner - Is it possible to minimise and maximise its window with Chromes main UI

In Tabs Outliner, the window stays put even though the main UI of chrome is minimised.

See here the UI of the extension and Chromes showing what I would like.

enter image description here

Is it possible in the settings or even via an AutoHotkey script to minisimise and maximise that tabs Outliner window along with Chromes?


Solution 1:

Yes, you can do this with AutoHotkey...

The easiest way to implement this is to monitor the active window whenever Chrome becomes active and then as soon as it is no longer active, check if it was minimized. If it was minimized, you can then minimize the other window.

Here's some basic example code below that you would need to tweak for your purposes--there are a few caveats.

  1. This is easy to do with a polling routine, but polling has latency of course. The alternative would be to hook the window events, but for the most part (and for sake of simplicity), polling will do pretty much what you want, i.e., even if it takes several hundred milliseconds, it will still be usable.

  2. Another caveat to this basic example is that you have to actually be using Chrome first in order for it to detect a minimize event. In real usage, sometimes you will not have Chrome active but will want to minimize it directly, in which case it would be minimized without being activated first. That can also be detected and handled simply by polling the window even after it's not active, but you would need to modify the basic example code in order to do that, which as-is, was not written to handle that case.

  3. Last caveat is that if you have multiple Chrome windows open then you would need to handle those a little bit differently. You wouldn't want to minimize Tabs Outliner just because the first Chrome window was minimized for example, but you may want to minimize it if all Chrome windows are minimized. This would require modifications to check how many windows are open, whether they are all minimized, etc.

It is also possible to implement full-blown 'docking' functionality as an extension of this concept (which works well, when implemented correctly), and in that case, depending on how much coding you want to do, you could possibly:

  • Keep the Tabs Outliner window 'docked' to a Chrome window (i.e., enforce 0 horizontal spacing between window edges on either the left or right side)
  • Keep the vertical height the same for both windows if one or the other is adjusted
  • Minimize Chrome whenever Tabs Outliner is minimized
  • Restore Chrome whenever Tabs Outliner is restored (see code that's commented out)
  • Unrestore Chrome if it's maximized and make room for Tabs Outliner
  • etc. etc. -- depends on how fancy you want to make it

Key takeaway though is that it's pretty easy to do using a polling loop in AutoHotkey and using the basic window functions that can check for size, state, modify the various windows involved, etc.

Example Code

SetTitleMatchMode, 2
tooltipsOn:=True  ; set false once finished debugging
Loop {
    If (ActiveID:=WinActive("Chrome ahk_exe chrome.exe")) {
        If tooltipsOn 
            Tooltip, Chrome detected active...
        WinWaitNotActive, ahk_id %ActiveID%
        If tooltipsOn 
            Tooltip, Chrome detected no longer active...
        WinGet, MinMaxState, MinMax, % "ahk_id" ActiveID
        If (MinMaxState=-1) {
            WinMinimize("Tabs Outliner")
            If tooltipsOn 
                Tooltip, Chrome detected no longer active... Minimizing Tabs Outliner...
        } Else If tooltipsOn 
            Tooltip, Chrome detected no longer active... MinMaxSate=%MinMaxState%
        
    } 
    ;Else If WinActive("Tabs Outliner") { ; restore chrome if Tabs Outliner is activated
    ;   If tooltipsOn
    ;       Tooltip, Found Tabs Outliner...
    ;   WinGet, MinMaxState, MinMax, % "ahk_id" WinExist("Chrome ahk_exe chrome.exe")
    ;   If (MinMaxState=-1)
    ;       WinRestore("Chrome ahk_exe chrome.exe")
    ;   
    ;   If tooltipsOn
    ;       Tooltip MinMaxState=%MinMaxState%
    ;   
    ;}
    
    If tooltipsOn {
        Sleep 1500  
        Tooltip
    }
        
    Sleep 10
}