Add mod to hide taskbar only on desktop - #5234
Conversation
This mod hides the taskbar when the desktop is active and shows it for other windows or when hovering near the bottom edge. It includes configurable settings for hover margin and auto-hide delay.
|
Thanks for the pull request! This repository uses a two-stage review: an AI review that you run yourself, followed by a human review. To get started, comment See the pull request review process for the full details. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Windhawk mod that hides the Windows taskbar when the desktop is active, and reveals it when an app/shell UI becomes active or when the mouse hovers near the reveal zone. It fits into the mods/ collection as a standalone Explorer-targeted behavior mod with configurable hover margin, hide delay, and optional secondary-taskbar handling.
Changes:
- Adds a new mod implementation with desktop/foreground detection and taskbar show/hide logic.
- Implements a bottom-edge hover reveal zone with configurable margin and hover hide delay.
- Adds support for hiding/showing secondary taskbars based on a setting.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| L"Shell_TrayWnd", | ||
| L"Shell_SecondaryTrayWnd", | ||
|
|
||
| L"Windows.UI.Core.CoreWindow", | ||
| L"Xaml_WindowedPopupClass", |
| settings.autoHideDelayMs = | ||
| static_cast<DWORD>( | ||
| Wh_GetIntSetting( | ||
| L"autoHideDelayMs" | ||
| ) | ||
| ); |
| return pt.y >= | ||
| monitorInfo.rcMonitor.bottom - | ||
| hotZonePx && | ||
|
|
||
| pt.y < |
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. The tool-mod structure and the teardown (message queue created before the ready event, 1. Consider extending the existing taskbar auto-hide mod instead of reimplementing auto-hide. Beyond catalog tidiness, the mechanism matters. That mod flips native auto-hide with the taskbar's private
The mod already stands down when native auto-hide is on, which is itself a sign the two mechanisms are solving the same problem. 2. Stale
Deriving the current state from 3. The mm→px conversion is off by a factor of 10, so the hover margin setting is effectively inert. int px = MulDiv(mm, static_cast<int>(dpi), 254);
// px = mm * dpi / 25.4
int px = MulDiv(mm * 10, static_cast<int>(dpi), 254);4. The 100 ms poll runs forever, including a synchronous cross-process call into Explorer.
Suggested shape: keep the timer only while it's actually needed (i.e. while 5. Make the worker thread per-monitor DPI aware. // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, so that all coordinates
// we deal with are real physical pixels.
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);6. Add a screenshot or GIF to the README. This is a visually obvious mod, and a short GIF of the taskbar hiding on the desktop and revealing on hover makes it much easier to understand. Images must be hosted on 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.
Next steps:
See the review process for details. |
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. The tool-mod structure and the teardown path (stop message → 1. The taskbar can be left permanently hidden when Windows' own auto-hide is turned on. In if (g_nativeAutoHideEnabled.load(std::memory_order_relaxed)) {
g_hideDeadline = 0;
g_shownDueToHover = false;
StopHoverTimer();
return; // <-- taskbar is still SW_HIDE'd if we hid it a moment ago
}Repro: sit on the desktop until the mod hides the taskbar, then enable "Automatically hide the taskbar" in Settings. The next refresh sees the native flag, stands down, and the taskbar window stays hidden. Native auto-hide can't rescue it either, because StopHoverTimer();
SetTaskbarVisibility(true);
return;2. Substantial overlap with existing mods, and the hiding mechanism is the blunt one. There are already several mods in this space:
Your trigger condition (desktop focused) is genuinely different from "a window is maximized" and from "idle for N seconds", so this isn't a straight duplicate — but "auto-hide the taskbar when condition X holds" is exactly what Related, and the reason the existing mod is worth studying: it doesn't hide the window at all — it toggles the taskbar's native auto-hide state via SendMessage(hTaskbarWnd, kHandleTrayPrivateSettingMessage,
kTrayPrivateSettingAutoHideSet, FALSE);With that approach Windows keeps ownership of reveal-on-hover, the slide animation, keyboard access ( 3. The hidden state isn't crash-safe. Restoration only happens in 4. Every window show/hide anywhere on the system triggers a synchronous cross-process call into Explorer.
Two fixes:
5. The README has no screenshot or GIF. This is a visual mod, and users browse the catalog by its README. Please add a short GIF showing the taskbar hiding on the desktop and revealing on hover — see the demo in taskbar-auto-hide-when-maximized for the format. Only 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.
Next steps:
See the review process for details. |
…nt hooks Updated mod metadata and improved event handling for taskbar visibility.
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. Nice work on the structure — the tool-mod choice is right for this (no function hooks, only 1. Overlap with existing mods — please explain how this differs, or consider extending one of them instead. The catalog already has a very close mod: There is also The maintainer's strong preference is to extend an existing mod (add an option, or PR the original author's repo) rather than merge a near-duplicate, since duplicates fragment the catalog. A "hide immediately when the desktop is focused (no idle timeout)" option in 2. The taskbar gets stuck visible after you click it, until you click something else. When the taskbar is the foreground window and the cursor is over it, Repro: with no application windows open, hover the bottom edge to reveal the taskbar, click an empty spot on it, then move the mouse to the middle of the screen. The taskbar stays up until you click the desktop or activate a window. The fix is to keep the timer alive whenever the "not desktop" verdict was caused by the taskbar itself, e.g.: // RefreshDesktopState()
if (IsTaskbarForegroundAndUnderCursor(foreground)) {
g_onDesktopState = false;
g_taskbarIsForeground = true; // new flag
return;
}
...
g_taskbarIsForeground = false;// UpdateTaskbarState(), "application state" branch
if (!g_onDesktopState) {
g_hideDeadline = 0;
g_shownDueToHover = false;
SetTaskbarVisibility(true);
EnsureHoverTimer(g_taskbarIsForeground); // keep polling while the taskbar has focus
return;
}3. The README has no screenshot or GIF. This mod has an obvious visual effect, so a short GIF showing the hide-on-desktop and hover-reveal behavior would help a lot — see 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.
Next steps:
See the review process for details. |
Added logic to manage taskbar focus state and desktop visibility.
|
This pull request has already had 3 AI reviews in the last 24 hours, which is the limit, so no review was posted this time. Comment |
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. The overall structure is sound — the tool-mod split, the per-monitor state array, the join-in-uninit teardown and the WinEvent + timer mix are all done correctly, and there are no lifetime/unloadability problems. The findings below are mostly about how much work the 200 ms tick does and about a couple of over-broad window classifications. 1. Every timer tick runs 3+ full Per 200 ms tick the mod currently does:
And the timer gating never lets it stop in the mod's own steady state — Fix: do one 2.
The comment is right that the process check alone is also insufficient (those hosts own other windows). The fix is to require both: the class must be a flyout class and the owner must be one of the known shell processes. You already have if (!IsShellUiClass(className) || !IsShellUiWindow(hwnd)) {
return false;
}3. Killing the tool process leaves the taskbar hidden until Explorer is restarted The README documents this, but it is worth reconsidering rather than documenting: Hosting the mod in 4. Overlap with
Please state explicitly in the PR how this differs — as far as I can tell the real difference is immediate, focus-driven hiding versus idle-timeout hiding, plus independent per-monitor evaluation. If that's the whole delta, adding a "hide as soon as only the desktop is visible" option (idle timeout of 0) to 5. README has no screenshot or GIF The mod has a very visible effect. Please add a short GIF showing the taskbar hiding on the desktop and revealing on hover — only 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.
Next steps:
See the review process for details. |
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. Nice work adopting the tool-mod pattern and per-monitor state — the structure is in good shape. A few things need attention before merge: 1. The 200 ms tick re-scans the whole desktop several times per second, forever, while the desktop is showing.
On a two-monitor setup that's 5 full window enumerations plus dozens of DWM RPCs and process-handle opens, 5×/second, indefinitely on an idle desktop. Two concrete fixes:
2.
case WM_SETTINGCHANGE:
case WM_DISPLAYCHANGE:
RequestStateRefresh();
return 0;3. The application scan skips
4. If the tool process dies while the taskbar is hidden, the taskbar stays hidden until Explorer restarts. The README documents this, which is good, but it's a fairly harsh failure mode for a crash/kill: 5. Keep the tool-mod launcher boilerplate byte-for-byte identical to the wiki snippet. Everything from 6. The README has no screenshot or GIF. This mod has an obvious visible effect, so a short GIF of the desktop→app→hover transitions would help a lot on windhawk.net. Only 7. Please state in the PR description how this differs from the existing taskbar auto-hide mods. The catalog already has taskbar-auto-hide-when-maximized, taskbar-auto-hide-per-monitor and taskbar-auto-hide-custom-activation-area. As far as I can tell yours is genuinely distinct — it's the inverse trigger of "auto-hide when maximized" (hide only when nothing is on the monitor) and it hides the window rather than using native auto-hide — but the maintainer's strong preference is to extend an existing mod over adding a near-neighbour, so it's worth making the case up front, including why an inverted mode on 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.
Next steps:
See the review process for details. |
|
/ai-review |
Submission reviewNote: This review was done by Claude. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Remember: The AI reviewer can be wrong - it may misread code, flag correct code as broken, or suggest changes that make things worse. Treat its findings as suggestions to verify, not instructions to follow blindly. You're responsible for the code you submit, so if a finding doesn't hold up, say so instead of changing working code to satisfy it. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. The tool-mod choice is right for this mod (no hooks, only 1. UWP / Store apps are not counted as applications, so the taskbar hides while one is in use
if (
IsShellChromeClass(className) ||
IsShellUiClass(className)
) {
return TRUE;
}
So with Calculator open and focused on an otherwise empty desktop: Drop if (IsShellUiClass(className) && IsShellUiWindow(hwnd)) {
return TRUE;
}2. The desktop window itself is counted as an application
Please verify this with 3. Several full
bool shellFlyoutOpen =
taskbar.shellUiForeground ||
HasVisibleShellFlyout(taskbar.monitor);
bool altTabActive =
IsAltTabActive();That's Two fixes, both straightforward:
4. The tool-mod launcher block has been reformatted The file comment says "Keep the official Windhawk launcher section below unchanged", but the block has been rewritten: every call re-wrapped across multiple lines, C-style casts changed to 5. No screenshot/GIF in the README The mod has a very visible effect, so a short GIF showing the taskbar hiding on the desktop and revealing on hover would help a lot on windhawk.net. Only 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.
Next steps:
See the review process for details. |
|
/ai-review |
|
This pull request has already had 3 AI reviews in the last 24 hours, which is the limit, so no review was posted this time. Comment |
This mod hides the taskbar when the desktop is active and shows it for other windows or when hovering near the bottom edge. It includes configurable settings for hover margin and auto-hide delay.
Difference from Existing Taskbar Auto-Hide Mods
This mod is related to the existing taskbar auto-hide mods, but its trigger and behavior are intentionally different.
taskbar-auto-hide-when-maximizedfocuses on the state of application windows, such as whether a window is maximized or intersects the taskbar. This mod instead uses the desktop/application state of each monitor: the taskbar is hidden when that monitor is showing only the desktop, and it becomes visible again when an application or Windows shell UI needs it.taskbar-auto-hide-per-monitorprovides per-monitor control over taskbar auto-hide behavior. This mod also supports independent per-monitor behavior, but its purpose is different: it automatically decides whether each taskbar should be visible based on whether an application is present on that monitor. For example, with two monitors, an application can remain open on monitor 2 while the taskbar on monitor 1 hides because monitor 1 is showing only the desktop.taskbar-auto-hide-custom-activation-areaprimarily changes the area used to trigger the taskbar's native auto-hide reveal. This mod uses a different model: it hides the taskbar window when the desktop is active and provides a configurable taskbar-sized hover area plus an additional margin for revealing it.A key difference is also the work-area behavior. This mod intentionally hides the taskbar window without changing the Windows desktop work area. This leaves the existing desktop/work-area layout unchanged, which is part of the reason this mod does not simply use Windows' native auto-hide mechanism.
The goal is therefore not to provide another general-purpose auto-hide implementation, but a specific "hide taskbar only when the desktop is active" behavior with independent per-monitor application state, configurable hover margin, and a configurable reveal/hide delay.
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.