Add Dynamic Alt Tab#4741
Conversation
chrisc44890
left a comment
There was a problem hiding this comment.
I changed the hooks to twinui_pcshell_dll_hooks in stead of just "hooks"
Attempt to fix Symbols error and hooks warning
Tried to kill two birds with one stone... The stone was unnafective, trying again
chrisc44890
left a comment
There was a problem hiding this comment.
Fingers crossed...
Save me Claude
chrisc44890
left a comment
There was a problem hiding this comment.
Save me Claude
|
Why does the mod target all processes and not just explorer.exe? |
That's a valid question, I noticed some issues with the interface not showing up with certain programs in the foreground when only explorer.exe is the only thing targeted. The simplest fix was targeting everything. |
|
I prefer to have it understood and solved properly. |
|
Alright I'll try to figure it out tonight |
I think this may have done the trick, also added some checks to prevent the interface from drawing on top of itself.
chrisc44890
left a comment
There was a problem hiding this comment.
This should do the trick, also added some checks to make sure the interface doesn't draw on top of itself and to prevent a held tab button from being interpreted as multiple key presses.
chrisc44890
left a comment
There was a problem hiding this comment.
Sorry one last update to fix lag when a game is chosen as the app to open.
|
What is the trick? Did I miss the answer? (Why does the mod target all processes and not just explorer.exe?) If the reason is elevated windows, have you tried using RegisterHotKey? It should support elevated windows, and also be better in terms of performance. That's what the Simple Window Switcher mod does, for example. |
|
Using PostMessageW to call WM_ALTTAB_TRIGGER, I could try RegisterHotKey but from what I understand I don't think it would give a KeyUp event which I'm using to play a closing animation for visual polish. |
|
Ahhh wait I copy and pasted my readme from before and forgot to change it to just explorer.exe, one sec |
chrisc44890
left a comment
There was a problem hiding this comment.
Fixed the include line. It works with just explorer.exe now
Submission reviewNote: This review was done by Claude, and then refined manually. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. 1. No single-instance guard — every Possible solution: Initialize lazily on first Alt+Tab hook. 2. The LL keyboard hook swallows Alt+Tab unconditionally, even when there's no overlay to show it. In HWND overlay = FindWindowW(L"GlassAltTabOverlayClass", L"GlassAltTabOverlay");
if (!overlay) return CallNextHookEx(NULL, nCode, wParam, lParam); // let the real Alt+Tab through
PostMessageW(overlay, WM_ALTTAB_TRIGGER, shiftDown ? 1 : 0, 0);
...
return 1;Be aware this hook also replaces Alt+Tab in every process system-wide (fullscreen games, RDP sessions, etc.), which is inherent to the fallback design — worth calling out in the README. 3. 4. The Optional improvements
Minor polish — none of this affects users, so it's your call.
Functionality notes
Non-critical observations and ideas about the feature behavior itself.
|
chrisc44890
left a comment
There was a problem hiding this comment.
Made all the necessary, optional, and functional changes. In this version of the code, including windhawk.exe fixed the elevated process issue without even needing the isWindhawk block so both of those changes were made with regard to the 4th note.
chrisc44890
left a comment
There was a problem hiding this comment.
Mentioned elevated process bug with the default alt-tab showing after a logoff or explorer.exe restarting in the README with a temporary fix.
Submission reviewPlease address the following issues. Also, why is 1. Crash (Explorer taken down) when the last card is closed — out-of-bounds // line ~867 and ~882
} else {
AppCard& activeCard = g_cards[g_selectedIndex]; // OOB if g_cards is empty / index == -1
...
}Reproduction: open the carousel and click the little "✕" close button on the cards one at a time until the last one is gone. Closing the last card runs: // WM_LBUTTONUP, line ~572
g_cards.erase(g_cards.begin() + i);
if (g_selectedIndex >= (int)g_cards.size()) g_selectedIndex = (int)g_cards.size() - 1; // -> -1 when empty
if (g_cards.empty()) { g_cancelAltTab = true; g_wantsToOpen = false; }
return 0;Now 2. Return-type mismatch on the using XamlAltTabViewHost_ViewLoaded_t = void(WINAPI*)(void*); // should return long
...
void WINAPI XamlAltTabViewHost_ViewLoaded_Hook(void* pThis) {
AutoThreadId lock;
XamlAltTabViewHost_ViewLoaded_Original(pThis); // original's long result is discarded
}The caller inside the shell expects a Optional improvements
Minor polish — none of this affects users, so it's your call.
Functionality notes
Non-critical observations about the feature behavior itself — no concrete change required, just things to be aware of.
|
|
@TheGamer1445891 @Lockframe thanks for noticing us. Hmm, interesting mod. Will test it. Me and @Asteski already made a mod called Simple Window Switcher. May I know what are the novelties in this mod ? |
I guess this should be the novelty. But I think it's better if you contribute to our mod as we have already added many features except for the themes and animations 😄 Currently, this mod still needs a lot of work as you can see in the screenshot.
I simply believe your best bet should be contibuting to the sws mod where I can add you as a fellow contributor to give credits and such. I'm already working on a draft PR fixing a few bugs and minor feature improvements here: #4776 |

Changelog
If this pull request updates an existing mod, describe the changes below:
Mod authorship
If this pull request introduces a new mod, please complete the section below.
This mod was created by:
Please select the options that best apply. Your selection does not affect the acceptance criteria, but it helps reviewers understand the context of the code and provide relevant feedback.