Solved Classic Alt Tab (Reincarnation)


OK thank you very much. I hope you find a way to do it, otherwise it's good as is.
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
OK thank you very much. I hope you find a way to do it, otherwise it's good as is.
i'll dig more into it Friday, probably. also noticed you changed the highlight shading of the icon to the blue square outline. if you want to post that portion of your code, i can add it to mine for when i get the dynamic expand working so it will resemble the classic alt tab gui more
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
Currently I have been testing with these ListView Styles:

Code:
Gui, Add, ListView,  +E0x200 +Border x4 y4 w580 h144 +LV0x3 +LV0x8000 +LV0x40 +LV0x10000 +AltSubmit +Icon +gOnListViewClick  +BackgroundF1F1F1 
;===============================================================================
; List Style (as is)                  +LV0x3
; icon hottrack                       +LV0x8000
; pointer as hand cursor              +LV0x40
; double buffer (reduce flicker?)     +LV0x10000 
; enable Singleclck to activate       +AltSubmit  with corresponding change to A_GuiEvent = "DoubleClick" >> A_GuiEvent = "Normal"
;===============================================================================
ref: Window and Control Styles | AutoHotkey v1 (or the Help Document in install).

Although hottracking works, there are 2 problems with it. First, it makes all icons show a very tiny outline around them, and to overcome it I have changed the background color of the ListView to match that thin outline. Secondly, the highlighted hottrack itself is very close to the icon.
To illustrate, have a look at the same with a dark background for the ListView.

alt2.webp
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
Currently I have been testing with these ListView Styles:

Code:
Gui, Add, ListView,  +E0x200 +Border x4 y4 w580 h144 +LV0x3 +LV0x8000 +LV0x40 +LV0x10000 +AltSubmit +Icon +gOnListViewClick  +BackgroundF1F1F1
;===============================================================================
; List Style (as is)                  +LV0x3
; icon hottrack                       +LV0x8000
; pointer as hand cursor              +LV0x40
; double buffer (reduce flicker?)     +LV0x10000
; enable Singleclck to activate       +AltSubmit  with corresponding change to A_GuiEvent = "DoubleClick" >> A_GuiEvent = "Normal"
;===============================================================================
ref: Window and Control Styles | AutoHotkey v1 (or the Help Document in install).

Although hottracking works, there are 2 problems with it. First, it makes all icons show a very tiny outline around them, and to overcome it I have changed the background color of the ListView to match that thin outline. Secondly, the highlighted hottrack itself is very close to the icon.
To illustrate, have a look at the same with a dark background for the ListView.

View attachment 133377
ahh gotcha. i had implemented that when i first tried it and didn't like the outline. thought you had managed to get rid of it. i just played with it more this morning and made a makeshift workaround!

1746721583104.webp

will be a bit more to implement, but i'll get the dark modes, etc made up. am posting this as its own code in post 1 as well (as another option if desired). it has multiple differences added in, so you'll just have to scan the code to find them. majority of them are referenced in any line with Gui 2 listed (but not all, so make sure to check). (ps - i also left in your single click. i only implemented a double click so one didnt choose the wrong option inadvertently).
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
At first I thought you had used 2 GUI's by mistake, but now I can see that setting a dark background in the ListView doesn't show the outlines on non selected icons. I shall have fun playing around with this ahk now :)

Thanks a lot.
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
At first I thought you had used 2 GUI's by mistake, but now I can see that setting a dark background in the ListView doesn't show the outlines on non selected icons. I shall have fun playing around with this ahk now :)

Thanks a lot.
i screenshot the gui when it had the hottrack white outlines, put it in paint and pulled the color code with the eyedropper. if you scan the newer code, you'll see WinSet, TransColor, F0F0F0. that makes the white outlines transparent. the Gui2 is a solid color, the same as the gui background color, thus "filling in" the transparent gaps so they are not visible. just a roundabout way of bypassing AHK limitations.
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
UPDATED 08 MAY 2025 (Final change for a while, unless features are requested):

Post 1
- All Light Mode HotTrack versions (looks almost identical to original Classic AltTab)
Post 3 - All Light Mode Highlight versions (instead of blue square outline, it shades the selected icon with a light blue overlay)
Post 4 - All Dark Mode Highlight versions (instead of blue square outline, it shades the selected icon with a light blue overlay)
Post 6 - All Light Mode HotTrack versions (looks almost identical to original Classic AltTab, but Dark)

If you want to request a custom color and are not sure how to modify the AHK code, request here and let me know the RGB color code and i will get one made up.

*IF you downloaded prior to 08 MAY 2025, please redownload the newest build as it has resolved a few issues.
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
That ghost frame is on purpose. It’s because the icons are actually in a listview segment and what I did was extend the listview width outside of the gui width just enough to make the scrollbar not visible.

here's your OnTop & Transparent custom color, just so you dont have to use other stuff to make it work right

View attachment 133246
@Edwin

here is your color with Hottracking. Transparency is giving me some issues because of how i implemented hottracking (it uses a transparency in its coding too). i'll keep playing with it, but you may be able to use your other tool to make the compiled exe transparent after launching like you did before.

1746740024386.webp
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
@dacrone: thank you for this amazing reincarnation of the classic Alt+Tab switcher! :)

2 technical issues being experienced on your latest build version: (1) when I am switching through the tabs, sometimes the Alt+Tab switcher will become "stuck" and require a manual mouse click instead of releasing the alt + tab keys. (2) Also sometimes the Alt+Tab switcher will randomly place white-colored hatchmarks around each of the icons in the Alt+Tab switcher, which again require a manual mouse click to resolve. Just curious, is it possible to adjust the source code so that these extra artifacts requiring manual mouse clicks can be removed? Thanks again so much in advance for your kind consideration!

(In case it is relevant: I was upgraded to 24H2 by my IT Shop, having previously used the AltTabSettings Registry tweak before being upgraded from 23H2, not sure if this is causing any possible issues?)
 

My Computer My Computer

At a glance

Windows 112x Intel Xeon Gold 6128 CPUs @ 3.40GHz128 GB
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Z8 G4
CPU
2x Intel Xeon Gold 6128 CPUs @ 3.40GHz
Memory
128 GB
i cannot replicate on 24h2. can you post screenshots of (at least the 2nd one... not sure how you'd capture the first without video).
offhand, the first issues sounds like you're using CTRL+ALT+TAB instead of ALT+TAB.
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
@dacrone;

In the alt tab script, is there any way to get a Count of the icons which eventually appear in the GUI after alt-tabbing? I am trying the following code, but it does not always match the ones shown inside the GUI - the GUI shows the number accurately.

Code:
; Count icons of visible Windows (exclude Progman, Blank Titles, Taskbar & Qsel utility)
WinGet, windowList, List
iconCount := 0
Loop, %windowList%
{
    iconID :=    windowList%A_Index%
    WinGet,      IStyle,   Style,      ahk_id %iconID%
    WinGet,      IExStyle, ExStyle,    ahk_id %iconID%
    WinGetTitle, Ititle,               ahk_id %iconID%
    WinGetClass, Iclass,               ahk_id %iconID%
    if (((IStyle & 0x10000000) or (IExStyle & 0x40000))    ; win Visible or win has taskbar icon
    && Ititle != ""                                        ; blank title
    && Ititle != "Qsel.exe"                                ; Qsel Tool
    && Iclass != "Progman"                                 ; Program Manager
    && Iclass != "Button"                                  ; Buttons
    && Iclass != "Shell_TrayWnd")                          ; Taskbar
    {
      iconCount++
    }
}
msgBox, Total icons:   %iconCount%

(jfi: My aim is to modify your script by using a Count to set a specific height (with a width already preset) for the GUI and then trying to reload the script after every alt+tab action. This way, when the icon Count changes, I can make the GUI just high enough to fit all the icons without showing any scrollbars or empty rows, and the GUI could get updated on not the next but the following alt+tab action - unless I find an alternate method of doing so).



Update: OK, found it - the last value of the variable %vCount% in your script provides the final Count.
Update 2: In the end I decided agianst restarting the script after every alt_tab action (it wasn't fast enough) - instead I just added another hotkey to make the height adjustment only when I needed it.
 

Attachments

  • new-3.webp
    new-3.webp
    32.8 KB · Views: 10
Last edited:

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
Dacrone; I used ChatGPT4 (not ashamed to say it, as I don't have in-depth knowledge of AHK), to help redesign the ALT+TAB Gui using parts of your AHK file together with some basic AHK ideas I had to try and make it look like the traditional Windows one, with auto align and justify together with just the few UWP icons I need. And after a lot (really lot) of prompts and corrections, this is the result. (For me, it is still a work-in-progress and may still need debugging, and although it only works on a single desktop, it is suitable for my own needs).

new-2.webp
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
Dacrone; I used ChatGPT4 (not ashamed to say it, as I don't have in-depth knowledge of AHK), to help redesign the ALT+TAB Gui using parts of your AHK file together with some basic AHK ideas I had to try and make it look like the traditional Windows one, with auto align and justify together with just the few UWP icons I need. And after a lot (really lot) of prompts and corrections, this is the result. (For me, it is still a work-in-progress and may still need debugging, and although it only works on a single desktop, it is suitable for my own needs).

View attachment 144718
I haven’t touched this in a long while. Feel free to post the code and I’ll check it out.
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
dacrone; Sorry for the delay (Coming up with my own idea of how to create the airgap between icons & the Highlight (Hottrack) took me a long time, although, the AI then helped implement it -it's not perfect, but does the job). From the get go, I had changed some fixed values to variables, so now, parts of it are easily configurable.

Current state of play:
Icons clickable.
Icons hoverable (releasing Alt when hovering on icon selects the hovered icon Window).
GUI Colors, icon spacing and icons per rows configurable. (in Config section).

AltTab.ahk.webp

I can't see the icon for posting my zip file with the icons, but here is the script:
AltTab.ahk (AHK version 1)
Code:
;;; 
;;; if (!A_IsCompiled && !InStr(A_AhkPath, "_UIA")) {        ; ADDED to always run with UIA so hotkey works even if elevated window is in foreground (eg: Task Manager)
;;;     Run % "*uiAccess " A_ScriptFullPath                  ;  requires AHK 1 installed with the UIA option selected 
;;;     ExitApp                                              ;    https://www.autohotkey.com/board/topic/70449-enable-interaction-with-administrative-programs/
;;; }

#SingleInstance Force
#NoEnv
#UseHook
SetBatchLines, -1
SetWinDelay, 0
SetKeyDelay, 0, 20
AutoTrim, Off
Process, Priority,, AboveNormal    ; RUN AT HIGH PRIORITY

; ---------------------------------- Config ----------------------------------
; -------------------------Change configuration here--------------------------
iconsPerRow    := 7                ; icons shown per row   
iconSize       := 32               ; 32 works best, any higher & anti-alias noticeable   
spacing        := 12               ; "x-axis" & "y-axis" space between icons
padX           := 12               ; padding at Left & Right of GUI
padY           := 16               ; padding at Top & Bottom of GUI
PanelColor     := 0xDEDEDE         ; GUI background color use any in Hex Format or only an AHK allowable name color in quotes (see: https://www.autohotkey.com/docs/v2/misc/Colors.htm)
TitleColor     := "BLACK"          ; Title Color
HighLightColor := 0x004DFF ;0x80FFFF         ; visible highlight color (outer) Hot track

; Double-layer highlight config
highlightGap   := 4                ; px gap between icon and inner mask (the "air" you see)
highlightThk   := 2                ; thickness of outer visible highlight

; Title placement option - (do NOT use - option needs some more debugging)
TitleBelowRows := true             ; true = title below icons, false = title above

;----------- calculations - don't edit (unless you want to)! -------------------------
; Outer highlight size will be calculated below from iconSize + 2*(gap + thk)
highlightSize  := iconSize + 2*(highlightGap + highlightThk)

maxwidth       := (iconsPerRow * iconSize) + ((iconsPerRow - 1) * spacing) + (2 * padX)
maxWidth_Text  := maxwidth - (2 * padX)

; ---------------------------------- Custom Icon Map ----------------------------------
; --- user specified icons for UWP Windows (make your own, or use samples included)----
; --------------------- to add more, follow the examples below ------------------------
global CustomIcons := {}
CustomIcons["ApplicationFrameWindow: Calculator"]           := "Calculator.ico"
CustomIcons["ApplicationFrameWindow: Settings"]             := "Settings-Lighter.ico"
CustomIcons["ApplicationFrameWindow: Camera"]               := "CameraAppList.ico"
CustomIcons["ApplicationFrameWindow: Clock"]                := "ClockWidgetIcon.ico"
CustomIcons["ApplicationFrameWindow: Windows Security"]     := "WindowsSecurityIcon.ico"
CustomIcons["#CLASS:ApplicationFrameWindow"]                := "Exe.ico"    ; fallback for AppFrame windows

; -------------------------------- Exclusions ----------------------------------------
; -----------exclude specific Windows (& their icons) from AltTab GUI----------------- 
global ExcludedTitles  := []     ; exact/substring matches to exclude
global ExcludedClasses := []     ; classes to exclude

global ExcludedRules := []       ; array of Objects: Exe/Class/Title combos
; Example: exclude IrfanView fullscreen window by exe + class:
ExcludedRules.Push(Object("Exe", "i_view64.exe", "Class", "FullScreenClass"))
ExcludedRules.Push(Object("Exe", "XnViewMP.exe", "Title", " - XnView MP"))

; ---------------------------------- Globals ----------------------------------
global guiActive := false
global oHWnd := {}, oTitle := {}
global vCount := 0, vIndex := 0
global IconX := [], IconY := []
global IconCtrlHwnd := []   ; store HWNDs of picture controls for hover detection
global hWndGUI := 0

~Alt::return

; ---------------------------------- Hotkeys ----------------------------------

!Tab::
    if (!guiActive) {
        Gosub, BuildAltTabGui
        if (vCount = 0)
            return
        vIndex := (vCount > 1) ? 2 : 1   ; start on 2nd icon if available
    } else {
        vIndex++
        if (vIndex > vCount)
            vIndex := 1
    }
    Gosub, UpdateHighlight
return

$+!Tab::
    if (!guiActive) {
        Gosub, BuildAltTabGui
        if (vCount = 0)
            return
        vIndex := vCount  ; start on last icon
    } else {
        vIndex--
        if (vIndex < 1)
            vIndex := vCount
    }
    Gosub, UpdateHighlight
return

Alt Up::
    if (guiActive) {
        if (vIndex >= 1 && vIndex <= vCount)
            WinActivate, % "ahk_id " oHWnd[vIndex]
        SetTimer, CheckHover, Off
        Gui, AltTab:Hide
        guiActive := false
        ForceModifierReset()   ; placeholder, kept for parity
    }
return

; ---------------------------------- GUI Builder ----------------------------------
BuildAltTabGui:
    oHWnd := {}, oTitle := {}, IconX := [], IconY := [], IconCtrlHwnd := []
    vCount := 0
    DetectHiddenWindows, Off
    WinGet, winList, List
    Loop % winList {
        hWnd := winList%A_Index%

        ; Quick Alt-Tab membership test
        if !JEE_WinHasAltTabIcon(hWnd)
            continue

        WinGetTitle, vWinTitle, ahk_id %hWnd%
        if (vWinTitle = "")
            continue

        WinGetClass, vClass, ahk_id %hWnd%
        WinGet, vProc, ProcessName, ahk_id %hWnd%

        ; arrays use .HasValue, but empty arrays won't match
        if (ExcludedTitles.HasValue && ExcludedTitles.HasValue(vWinTitle))
            continue
        if (ExcludedClasses.HasValue && ExcludedClasses.HasValue(vClass))
            continue

        ; exclusion rules (object array)
        for i, rule in ExcludedRules {
            matchExe   := !rule.HasKey("Exe")   || (rule.Exe   = vProc)
            matchClass := !rule.HasKey("Class") || (rule.Class = vClass)
            matchTitle := !rule.HasKey("Title") || (rule.Title = vWinTitle)
            if (matchExe && matchClass && matchTitle) {
                continue 2
            }
        }

        vCount++
        oHWnd[vCount]  := hWnd
        ; Prepend a space to titles to stay consistent with earlier matching logic
        oTitle[vCount] := " " . vWinTitle
    }
    DetectHiddenWindows, On

    if (vCount = 0)
        return

    Gui, AltTab:Destroy
    Gui, AltTab:New, +AlwaysOnTop -Caption +Owner +ToolWindow hwndhWndGUI +Border
    Gui, AltTab:Color, %PanelColor%
    Gui, AltTab:Margin, 0, 0

    ; Double-layer highlight controls (Disabled so they do not intercept mouse)
    ; Outer: visible highlight
    Gui, AltTab:Add, Progress, x0 y0 w%highlightSize% h%highlightSize% vOuterGlow -Smooth Background%HighLightColor% -Border Hidden Disabled
    ; Inner: mask filled with panel color to create "air gap"
    innerSize := iconSize + 2*highlightGap
    Gui, AltTab:Add, Progress, x0 y0 w%innerSize% h%innerSize% vInnerMask -Smooth Background%PanelColor% -Border Hidden Disabled

    ; Icons in rows
    x := padX, y := padY, rowHeight := iconSize + spacing
    Loop % vCount {
        idx := A_Index
        hLocal := oHWnd[idx]
        tLocal := oTitle[idx]
        WinGetClass, vClass, ahk_id %hLocal%
        WinGet, vProc, ProcessName, ahk_id %hLocal%

        IconX[idx] := x
        IconY[idx] := y

        opt := "x" x " y" y " w" iconSize " h" iconSize " hwndhCtl gOnIconClick vI" . idx

        ; --- Try custom icon resolver first ---
        path := GetCustomIconPath(vClass, tLocal, vProc)
        if (path != "") {
            Gui, AltTab:Add, Picture, %opt%, % path
        } else {
            ; Fallback: get real HICON from window
            hIcon := JEE_WinGetIcon(hLocal, 1)
            if !hIcon
                continue
            Gui, AltTab:Add, Picture, %opt%, % "HICON:" hIcon
        }

        ; store control HWND for hover detection
        GuiControlGet, hwndhCtl, Hwnd, I%idx%
        IconCtrlHwnd[idx] := hwndhCtl

        x += iconSize + spacing
        if (x + iconSize + padX > maxwidth) {
            x := padX
            y := y + rowHeight
        }
    }

    ; --- Center the last row if it has fewer icons than iconsPerRow --- 
    ; Remove this block if you don't want to center the icons 
    iconsPerRow_calc := Floor((maxwidth - padX*2 + spacing) / (iconSize + spacing))
    if (iconsPerRow_calc < 1)
        iconsPerRow_calc := 1

    lastRowCount := Mod(vCount, iconsPerRow_calc)
    if (lastRowCount = 0 && vCount >= iconsPerRow_calc)
        lastRowCount := iconsPerRow_calc
    if (lastRowCount > 0 && lastRowCount < iconsPerRow_calc) {
        usedWidth := (lastRowCount * (iconSize + spacing)) - spacing
        offsetX := ((maxwidth - 2*padX) - usedWidth) // 2
        Loop % lastRowCount {
            idx2 := vCount - lastRowCount + A_Index
            IconX[idx2] += offsetX
            GuiControl, AltTab:Move, I%idx2%, % "x" IconX[idx2] " y" IconY[idx2]
        }
    }

    ; --- calculate occupied rows and position title depending on TitleBelowRows ---
    rows := Ceil(vCount / iconsPerRow)
    if (TitleBelowRows) {
        ; Title below icons
        y := padY + rows * (iconSize + spacing) - spacing + (0.75 * padY)
        Gui, AltTab:Font, s10 w600 c%TitleColor%, Segoe UI Variable Display Semibol
        Gui, AltTab:Add, Text, x%padX% y%y% w%maxWidth_Text% h30 vTitleText +Border +0x80 +0x200 +0x4000 +0x1000,
        totalHeight := y + 40
    } else {
        ; Title above icons
        ; place title at top, push rows downward
        Gui, AltTab:Font, s10 w600 c%TitleColor%, Segoe UI Variable Display Semibol
        Gui, AltTab:Add, Text, x%padX% y%padY% w%maxWidth_Text% h30 vTitleText +Border +0x80 +0x200 +0x4000 +0x1000,
        ; shift icon area down by title height
        rowsAreaHeight := rows * (iconSize + spacing) - spacing
        totalHeight := padY + 30 + padY + rowsAreaHeight + padY  ; crude but safe
        ; re-calc row area start so highlight positions align (we used IconY previously so they should be fine)
    }

    Gui, AltTab:Show, % "w" maxwidth " h" totalHeight " Center", Alt-Tab
    guiActive := true

    SetTimer, CheckHover, 50  ; check mouse 20x/sec
return

; ---------------------------------- Highlight + Title ----------------------------------
UpdateHighlight:
    if (vIndex < 1 || vIndex > vCount)
        return

    ; compute placement so outer fully surrounds inner mask by highlightThk
    ; outer top-left = IconX - (highlightGap + highlightThk)
    ox := IconX[vIndex] - (highlightGap + highlightThk)
    oy := IconY[vIndex] - (highlightGap + highlightThk)
    GuiControl, AltTab:Move, OuterGlow, % "x" ox " y" oy " w" highlightSize " h" highlightSize
    GuiControl, AltTab:Show, OuterGlow
    GuiControl, AltTab:MoveDraw, OuterGlow

    ; inner mask top-left = IconX - highlightGap
    ix := IconX[vIndex] - highlightGap
    iy := IconY[vIndex] - highlightGap
    innerSize := iconSize + 2*highlightGap
    GuiControl, AltTab:Move, InnerMask, % "x" ix " y" iy " w" innerSize " h" innerSize
    GuiControl, AltTab:Show, InnerMask
    GuiControl, AltTab:MoveDraw, InnerMask

    GuiControl, AltTab:, TitleText, % oTitle[vIndex]
return

; ---------------------------------- Mouse Hover Tracking ----------------------------------
CheckHover:
    if (!guiActive)
        return
    MouseGetPos, , , win, ctrl
    if (win != hWndGUI || ctrl = "")
        return
    ControlGet, ctrlHwnd, Hwnd,, %ctrl%, ahk_id %win%
    if (!ctrlHwnd)
        return
    Loop % vCount {
        if (ctrlHwnd = IconCtrlHwnd[A_Index]) {
            if (A_Index != vIndex) {
                vIndex := A_Index
                Gosub, UpdateHighlight
            }
            break
        }
    }
return

; ---------------------------------- Mouse Click Handler ----------------------------------
OnIconClick:
    idx := SubStr(A_GuiControl, 2)  ; "I#" → #
    if (idx >= 1 && idx <= vCount) {
        vIndex := idx
        WinActivate, % "ahk_id " oHWnd[vIndex]
        SetTimer, CheckHover, Off
        Gui, AltTab:Hide
        guiActive := false
        ForceModifierReset()
    }
return

; ---------------------------------- Icon helper ----------------------------------
JEE_WinGetIcon(hWnd, vDoGetBig:=0) {
    static vSfx := (A_PtrSize=8) ? "Ptr" : ""
    if !hWnd || !WinExist("ahk_id " hWnd)
        return 0
    if vDoGetBig {
        if (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",1, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",0, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",2, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\GetClassLong" vSfx, "Ptr",hWnd, "Int",-14, "UPtr"))
         || (hIcon := DllCall("user32\GetClassLong" vSfx, "Ptr",hWnd, "Int",-34, "UPtr"))
         || (hIcon := DllCall("user32\LoadIcon", "Ptr",0, "Ptr",32512, "Ptr"))
            return hIcon
    } else {
        if (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",0, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",2, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\SendMessage", "Ptr",hWnd, "UInt",0x7F, "UPtr",1, "Ptr",0, "Ptr"))
         || (hIcon := DllCall("user32\GetClassLong" vSfx, "Ptr",hWnd, "Int",-34, "UPtr"))
         || (hIcon := DllCall("user32\GetClassLong" vSfx, "Ptr",hWnd, "Int",-14, "UPtr"))
         || (hIcon := DllCall("user32\LoadIcon", "Ptr",0, "Ptr",32512, "Ptr"))
            return hIcon
    }
    return 0
}

; ---------------------------------- Alt+Tab membership ----------------------------------
JEE_WinHasAltTabIcon(hWnd) {
    if !(DllCall("user32\GetDesktopWindow", "Ptr") = DllCall("user32\GetAncestor", "Ptr",hWnd, "UInt",1, "Ptr"))
        return 0
    WinGet, vWinStyle, Style, % "ahk_id " hWnd
    if !vWinStyle || !(vWinStyle & 0x10000000) || (vWinStyle & 0x8000000)
        return 0
    WinGet, vWinExStyle, ExStyle, % "ahk_id " hWnd
    if (vWinExStyle & 0x40000)
        return 1
    if (vWinExStyle & 0x80) || (vWinExStyle & 0x8000000)
        return 0
    return 1
}

; ---------------------------------- Custom Icon Resolver ----------------------------------
GetCustomIconPath(vClass, title, proc) {
    global CustomIcons
    key1 := vClass ":" title
    key2 := "#TITLE:" . title
    key3 := "#CLASS:" . vClass
    key4 := "#PROC:"  . proc

    if (CustomIcons.HasKey(key1))
        return CustomIcons[key1]
    if (CustomIcons.HasKey(key2))
        return CustomIcons[key2]
    if (CustomIcons.HasKey(key3))
        return CustomIcons[key3]
    if (CustomIcons.HasKey(key4))
        return CustomIcons[key4]
    return ""
}

; ---------------------------------- Modifier reset helper ----------------------------------
ForceModifierReset() {
    ; placeholder (kept empty by design)
}




;--reload script - only used when live editing this script for debugging---
~^k::
reload
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
dacrone; Sorry for the delay (Coming up with my own idea of how to create the airgap between icons & the Highlight (Hottrack) took me a long time, although, the AI then helped implement it -it's not perfect, but does the job). From the get go, I had changed some fixed values to variables, so now, parts of it are easily configurable.

Current state of play:
Icons clickable.
Icons hoverable (releasing Alt when hovering on icon selects the hovered icon Window).
GUI Colors, icon spacing and icons per rows configurable. (in Config section).

View attachment 145029

I can't see the icon for posting my zip file with the icons, but here is the script:
well done. i'll look into it and play with it some in spare time. if you have a .zip to attach, just drag it into the reply/typing section and it will auto-upload. not sure what the size limitations are.
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
OK, done. Sample icons attached.
 

Attachments

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
@das10

updates:
1) shows on screen that cursor is on
2) ctrl alt tab keeps gui open until selection is made
a) can navigate via mouse, arrows or tab/shift tab
b) can select via mouse, space or enter
3) tray menu right click has:
Light / Dark mode toggle
Rounded / Squared Toggle
Show Ctrl+Alt+Tab persistent GUI
4) bottom row is left-aligned (did not remove your code, but commented out
5) Double Clicking Tray Icon shows Ctrl+Alt+Tab persistent GUI


* i had added a tray menu option to apply accent color to match your theme(s) but it is not converting the reg values correctly so colors are off. will work on it more later

* also playing with dynamically loading uwp icons from script directory. not implemented yet but will be soon.
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
dacrone; Thank you for the script with the tray options. When you get back to working on it (take your time), could you see what is blocking the ESC key when your script is running?

Kind regards.
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
dacrone; Thank you for the script with the tray options. When you get back to working on it (take your time), could you see what is blocking the ESC key when your script is running?

Kind regards.
what do you mean blocking it? when ctrl alt tab and it stays open, esc will close it without selecting anything. i put that at the bottom of the script
 

My Computer My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
Sorry,what I meant was that when the script is running but the AltTab GUI has not been invoked, the ESC key does not seem to work globally.
 

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans

Latest Support Threads

Back
Top Bottom