Skip to content

About

Toggle Windows 11 taskbar auto-hide with a global hotkey. Zero dependencies, ~6 KB exe, ms-level response, stays in sync with Windows Settings.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TaskbarAutoHideToggle

Toggle the Windows 11 taskbar auto-hide state with a global hotkey — a single ~6 KB C# executable with zero dependencies.

  • Press the hotkey → taskbar switches between always show and auto hide instantly
  • Stays 100% in sync with Settings > Personalization > Taskbar > Automatically hide the taskbar (it flips the exact registry value that UI writes)
  • Resident listener registers the hotkey via RegisterHotKey — response is millisecond-level, not the 1–5 s lag you get from .lnk shortcut hotkeys
  • Idle footprint: 0% CPU (blocking message loop, no polling), ~9 MB private memory
  • No installer, no runtime to download, no admin rights needed

Why

  1. Windows 11 has no built-in hotkey for this (confirmed by Microsoft Q&A, 2026-03).
  2. The common DIY recipe (desktop shortcut hotkey + PowerShell script) is slow: .lnk hotkeys are processed lazily by Explorer, then PowerShell + C# runtime compilation adds seconds. Measured on a real machine: 4 s end-to-end; the actual toggle logic takes 8–21 ms.
  3. Existing utilities either hide the taskbar by manipulating its window (breaks right-click / edge reveal / crashes reported), or are AHK scripts that require installing the AutoHotkey runtime.

This tool does the minimal correct thing: flip the persisted auto-hide bit, apply it live via the official AppBar API, and own the hotkey in-process.

How it works

The auto-hide state lives in:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3
value "Settings" (REG_BINARY), byte index 8:
  0x02 = always show  (ABS_ALWAYSONTOP)
  0x03 = auto hide    (ABS_ALWAYSONTOP | ABS_AUTOHIDE)

Toggle = flip bit 0x01 of that byte, then call shell32.SHAppBarMessage(ABM_SETSTATE) so Explorer applies it immediately without a restart. Because the persisted value is the same one the Settings UI reads, the two never drift apart.

The hotkey is a plain RegisterHotKey(MOD_CONTROL | MOD_ALT, 'T') + GetMessage loop inside the exe — the same mechanism AHK uses, without AHK.

Note: HKCU\...\Explorer\Advanced\TaskbarAl is icon alignment (0 = center, 1 = left), not auto-hide. Several popular tutorials confuse the two — this tool never touches it.

Build

One line with the compiler that ships with Windows (.NET Framework 4.x, present on every Win10/11):

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /nologo /optimize /target:winexe /out:ToggleTaskbar.exe src\ToggleTaskbar.cs

Or run build.ps1.

Usage

ToggleTaskbar.exe            # one-shot toggle (double-click friendly)
ToggleTaskbar.exe --listen   # register global hotkey Ctrl+Alt+T and stay resident

Recommended setup:

  1. Build the exe.
  2. Create a shortcut to ToggleTaskbar.exe --listen in shell:startup → hotkey works after every sign-in.
  3. (Optional) A plain shortcut to the exe (no arguments) on the desktop for double-click toggling.

Change the hotkey

Edit in src/ToggleTaskbar.cs:

const uint VK_T = 0x54;   // virtual-key code of the key

then rebuild. Any VK code works, e.g. 0x48 = H. Modifier is currently MOD_CONTROL | MOD_ALT.

Resource usage (measured, resident listener on Windows 11 24H2)

Metric Value
Working set 16.4 MB (mostly shared .NET runtime images)
Private memory 9.4 MB
CPU while idle 0% (blocking GetMessage)
Toggle logic 8–21 ms (internal stopwatch)
Network / disk none (one log line per toggle if enabled)

Tested on

  • Windows 11 24H2 (26100), single primary taskbar
  • Multi-monitor secondary taskbars (Shell_SecondaryTrayWnd) are not toggled — only the primary StuckRects3 entry is modified

Alternatives considered

Approach Drawback
.lnk shortcut hotkey + script Explorer processes shortcut hotkeys lazily → 1–5 s delay
Buttery Taskbar 2 etc. (window-hiding tools) break right-click / edge reveal; stability reports vary
AutoHotkey scripts same result, but requires the AHK runtime installed

License

MIT — see LICENSE.

About

Toggle Windows 11 taskbar auto-hide with a global hotkey. Zero dependencies, ~6 KB exe, ms-level response, stays in sync with Windows Settings.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages