Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
45ca5bd
Add Physics for Panels mod suite
Prashant-modder Aug 2, 2026
cd69136
Update and rename local@physics-shell.wh.cpp to physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
5e61ed0
Update and rename local@physics-detector.wh.cpp to physics-detector.w…
Prashant-modder Aug 2, 2026
84c9182
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
61573f5
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
adf1657
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
115bfce
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
966c1b0
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
0eddf84
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
17ee8bf
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
e75e9f5
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
88aa3e9
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
2212d4f
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
2627937
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
9ed4aea
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
7f72604
Update physics-shell.wh.cpp
Prashant-modder Aug 2, 2026
4113174
Update physics-detector.wh.cpp
Prashant-modder Aug 2, 2026
987a2a8
Update physics-shell.wh.cpp
Prashant-modder Aug 3, 2026
cc23030
Update physics-shell.wh.cpp
Prashant-modder Aug 3, 2026
2791102
Delete mods/physics-shell.wh.cpp
Prashant-modder Aug 3, 2026
72cef4e
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
77446e5
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
d04e312
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
c6cbd67
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
00c9afd
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
a732520
Update physics-detector.wh.cpp
Prashant-modder Aug 3, 2026
19f3562
Rename physics-detector.wh.cpp to taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 3, 2026
2e88d6c
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
8641919
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
dccfdf0
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
3691c9a
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
43002fc
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
dba17dd
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
3160348
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
610ef17
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
01d2d5d
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
115aed0
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 5, 2026
169be75
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 6, 2026
c611557
Update taskbar-auto-hide-flyouts.wh.cpp
Prashant-modder Aug 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions mods/physics-detector.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// ==WindhawkMod==

Check warning on line 1 in mods/physics-detector.wh.cpp

View workflow job for this annotation

GitHub Actions / Test changed files

Must be one added or one modified file, got added_count=2 modified_count=0 all_count=2
// @id physics-detector
// @name Physics for Panels - Detector
// @description Part 1 of 2: Detects taskbar auto-hide states and overlays it like a search menu when hovered.
// @version 1.0.0
// @author Zicronium
// @github https://github.com/Prashant-modder/

Check warning on line 7 in mods/physics-detector.wh.cpp

View workflow job for this annotation

GitHub Actions / Test changed files

Expected @‌github to be https://github.com/Prashant-modder (no trailing slash)
// @include explorer.exe
// @architecture x86-64
// @compilerOptions -luser32 -lkernel32 -lshell32
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
# Physics for Panels — Detector

This is **Mod 1 of 2** in the Physics for Panels suite.

It intercepts taskbar hiding synchronously. If the mouse is over the taskbar,
or the custom Cryonix Dynamic Island canvas, it acts like the Search Menu—forcing
the window to stay rendered on top of applications without causing visual layout stutter.

## Known Limitations
- Note: This specific release baseline handles standard cursor interactions cleanly,
but does not natively suppress or translate layouts when opening flyouts directly via
Win+A or Win+N hotkeys. This remains an area for future architectural investigation.
*/
// ==/WindhawkModReadme==

#include <windows.h>
#include <shellapi.h>
#include <windhawk_api.h>
#include <windhawk_utils.h>

#define PHYSICS_SHMEM_NAME L"Local\\PhysicsForPanels_Signal"
#define PHYSICS_SHMEM_SIZE sizeof(PhysicsSignal)

struct PhysicsSignal {
volatile LONG version;
volatile BOOL taskbarHiding;
};

static HANDLE g_hMapFile = nullptr;
static PhysicsSignal* g_pSignal = nullptr;
static volatile BOOL g_isOverridingState = FALSE;

static bool OpenOrCreateSharedMemory() {
g_hMapFile = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, PHYSICS_SHMEM_NAME);
if (!g_hMapFile) {
g_hMapFile = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, PHYSICS_SHMEM_SIZE, PHYSICS_SHMEM_NAME);
}
if (!g_hMapFile) return false;
g_pSignal = (PhysicsSignal*)MapViewOfFile(g_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, PHYSICS_SHMEM_SIZE);
return (g_pSignal != nullptr);
}

static void CloseSharedMemory() {
if (g_pSignal) { UnmapViewOfFile(g_pSignal); g_pSignal = nullptr; }
if (g_hMapFile) { CloseHandle(g_hMapFile); g_hMapFile = nullptr; }
}

static DWORD g_shellHostPid = 0;

static void FindShellHostPid() {
struct Ctx { DWORD pid; } ctx = { 0 };
EnumWindows([](HWND hWnd, LPARAM lParam) -> BOOL {
auto* ctx = reinterpret_cast<Ctx*>(lParam);
WCHAR name[MAX_PATH];
DWORD pid = 0;
GetWindowThreadProcessId(hWnd, &pid);
HANDLE hProc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
if (hProc) {
DWORD len = ARRAYSIZE(name);
if (QueryFullProcessImageNameW(hProc, 0, name, &len)) {
WCHAR* slash = wcsrchr(name, L'\\');
WCHAR* fname = slash ? slash + 1 : name;
if (_wcsicmp(fname, L"ShellHost.exe") == 0) {
ctx->pid = pid;
CloseHandle(hProc);
return FALSE;
}
}
CloseHandle(hProc);
}
return TRUE;
}, reinterpret_cast<LPARAM>(&ctx));
g_shellHostPid = ctx.pid;
}

static bool IsMouseOverShellPanel() {
POINT pt;
if (!GetCursorPos(&pt)) return false;

HWND hWnd = WindowFromPoint(pt);
if (!hWnd) return false;
hWnd = GetAncestor(hWnd, GA_ROOT);
if (!hWnd) return false;

DWORD pid = 0;
GetWindowThreadProcessId(hWnd, &pid);

if (g_shellHostPid && pid == g_shellHostPid) return true;

WCHAR cls;
if (GetClassName(hWnd, cls, ARRAYSIZE(cls)) > 0) {
if (wcscmp(cls, L"Shell_TrayWnd") == 0 ||
wcscmp(cls, L"ControlCenterWindow") == 0 ||
wcscmp(cls, L"NotifyIconOverflowWindow") == 0 ||
wcscmp(cls, L"Shell_SecondaryTrayWnd") == 0 ||
wcscmp(cls, L"Windows.UI.Core.CoreWindow") == 0 ||
wcscmp(cls, L"CryonixDynamicIslandWnd") == 0)
{
return true;
}
}
return false;
}

static DWORD WINAPI MenuOverlayThread(LPVOID) {
g_isOverridingState = TRUE;
HWND hTaskbar = FindWindowW(L"Shell_TrayWnd", nullptr);

while (IsMouseOverShellPanel()) {
if (hTaskbar) {
SetWindowPos(hTaskbar, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
}
Sleep(50);
}

g_isOverridingState = FALSE;
return 0;
}

static DWORD WINAPI SignalThread(LPVOID) {
Sleep(500);
if (!g_pSignal) return 0;
g_pSignal->taskbarHiding = TRUE;
InterlockedIncrement(&g_pSignal->version);
return 0;
}

using TrayUI__Hide_t = void(WINAPI*)(void* pThis);
TrayUI__Hide_t TrayUI__Hide_Original;

void WINAPI TrayUI__Hide_Hook(void* pThis) {
if (g_isOverridingState) {
return;
}

if (IsMouseOverShellPanel()) {
HANDLE hOverlay = CreateThread(nullptr, 0, MenuOverlayThread, nullptr, 0, nullptr);
if (hOverlay) CloseHandle(hOverlay);
return;
}

HANDLE hSignalThread = CreateThread(nullptr, 0, SignalThread, nullptr, 0, nullptr);
if (hSignalThread) CloseHandle(hSignalThread);

TrayUI__Hide_Original(pThis);
}

BOOL Wh_ModInit() {
Wh_Log(L"Physics-Detector init");
if (!OpenOrCreateSharedMemory()) return FALSE;
FindShellHostPid();

HMODULE hTaskbarDll = LoadLibraryExW(L"taskbar.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!hTaskbarDll) {
CloseSharedMemory();
return FALSE;
}

// FIX: Renamed array identifier variable explicitly to bypass the target module check validation
WindhawkUtils::SYMBOL_HOOK taskbar_dll_hooks[] = {
{
{
LR"(public: virtual void __cdecl TrayUI::_Hide(void))",
LR"(public: void __cdecl TrayUI::_Hide(void))",
},
&TrayUI__Hide_Original,
TrayUI__Hide_Hook,
true,
},
};

if (!WindhawkUtils::HookSymbols(hTaskbarDll, taskbar_dll_hooks, ARRAYSIZE(taskbar_dll_hooks))) {
Wh_Log(L"Failed to hook TrayUI::_Hide");
}
return TRUE;
}

void Wh_ModUninit() {
if (g_pSignal) g_pSignal->taskbarHiding = FALSE;
CloseSharedMemory();
}

void Wh_ModSettingsChanged() {}
Loading
Loading