Skip to content

Keep the taskbar hidden when switching dock modes - #24

Open
RayTrunk wants to merge 3 commits into
SumirSeth:mainfrom
RayTrunk:fix/taskbar-flash-on-mode-switch
Open

RayTrunk wants to merge 3 commits into
SumirSeth:mainfrom
RayTrunk:fix/taskbar-flash-on-mode-switch

Conversation

@RayTrunk

@RayTrunk RayTrunk commented Nov 7, 2026

Copy link
Copy Markdown

What changed
While Wisp hides the taskbars, each one now also gets an empty window region (SetWindowRgn). If Explorer shows a taskbar, it draws nothing. The region is set only once the taskbars are hidden, and removed before a peek from the chevron menu and on restore (also from the watchdog, which uses restore_snapshot).

Why
Switching between autohide and Keep the dock visible adds or removes the dock's app bar, which changes the work area. Explorer then shows its taskbars again, roughly 250–350 ms later and several times in a row. The show hook hides them, but only after they have drawn, which is the flash in #18. A direct test confirmed the trigger: SPI_SETWORKAREA with SPIF_SENDCHANGE makes Explorer show its taskbars immediately; without the broadcast it doesn't.

On the primary screen the shown taskbar is mostly the collapsed auto-hide strip, so the flash is most visible on secondary screens, where Shell_SecondaryTrayWnd sits fully on screen when shown.

Clipping a taskbar while it's still visible made Explorer show it again, so the region goes on only after the hide has been verified.

How I checked it
Windows 11, two screens (2560×1440 primary and 1920×1080 secondary, both at 125%), hide_taskbar = true.

  • A script toggled dock_autohide 10 times (5 cycles) through WM_APP + 6 and captured the bottom strip of the secondary screen every ~12 ms. Frames that showed the taskbar: 56 on unmodified main (every switch), 0 with this change.
  • Logged taskbar visibility and region over the switches: Explorer still shows the windows (IsWindowVisible toggles as before), but the region stays empty. Explorer sometimes drops the region on a secondary taskbar while it's hidden; the next reapply sets it again.
  • Quit Wisp: the taskbar comes back with its full shape. With Wisp not running, clearing and setting the region on a visible taskbar hid and restored it cleanly.
  • Startup: the first hide sometimes needs a few retries on my machine, but unmodified main does too, so it isn't caused by this change.
  • cargo fmt --check and both clippy runs pass. On my machine (German Windows), cargo test fails commands::time::tests::finds_cities_in_the_windows_zone_list and commands::tests::finds_power_commands_time_and_settings; both fail the same way on unmodified main.

Not tested: Windows 10, virtual desktops, a peek from the chevron menu after the change.

Fixes #18

🤖 Generated with Claude Code

RayTrunk and others added 2 commits November 7, 2026 20:01
Explorer shows its taskbars again whenever the work area changes, as when
the dock's space comes or goes on switching between autohide and Keep the
dock visible. The show hook hides them again, but only after they have
drawn, so they flashed several times for about 250 ms (SumirSeth#18).

While hidden, each taskbar now also gets an empty window region, so such a
show draws nothing. The region is set only once the taskbars are hidden,
and removed before a peek and on restore, including the watchdog's.

Measured over 10 mode switches on a second screen: 56 captured frames
showed the taskbar before, none after.

Fixes SumirSeth#18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SumirSeth

Copy link
Copy Markdown
Owner

Appreciate the PR. I have some local code for this fix, I'll see how our approaches overlap (or don't) and get this merged as appropriate.

Explorer gives each taskbar a rectangular window region the size of the
window. The first version set no region on restore, which left the
second screen's taskbar without one until Explorer laid it out again.

The snapshot now keeps each taskbar's own region, and a peek or restore,
including the watchdog's, sets it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RayTrunk

RayTrunk commented Nov 7, 2026

Copy link
Copy Markdown
Author

Correction pushed (6ba85ba). The first version assumed Explorer's taskbars have no window region of their own. They do: a simple region the size of the window (0,0,2560,60 and 0,0,1920,48 here). On restore, the first version set no region, which left the second screen's taskbar without one until Explorer laid it out again.

Now Bar keeps the taskbar's own region in the snapshot, taken before Wisp changes anything. A peek and restore_snapshot set it again, and the watchdog gets it through --bar.

Checked after the change:

  • Normal quit and a forced kill (so the watchdog restores): both taskbars end with exactly their original region and are visible.
  • 10 mode switches, captures of the second screen: 0 frames with the taskbar.

Startup. While checking this, I noticed the first hide at startup sometimes fails ("A taskbar remained visible after SW_HIDE"). The hider is then restored and retried, and the taskbar stays visible for 3.8–6.6 s. This also happens without this PR:

Build Starts First hide failed
v0.5.0 release 20 2
Local build of unmodified main 12 3
This PR 22 7
This PR with the clipping switched off 8 1

The samples are too small to say whether this PR changes the rate, so I'm not claiming it doesn't. I'll open a separate issue for the startup failure itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taskbar flashes when switching dock modes

2 participants