Skip to content

Add Taskbar Virtual Desktop Switcher v1.0#3932

Merged
m417z merged 8 commits into
ramensoftware:mainfrom
sb4ssman:sb4ssman-taskbar-vd-switcher
Jun 17, 2026
Merged

Add Taskbar Virtual Desktop Switcher v1.0#3932
m417z merged 8 commits into
ramensoftware:mainfrom
sb4ssman:sb4ssman-taskbar-vd-switcher

Conversation

@sb4ssman

@sb4ssman sb4ssman commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new mod: Taskbar Virtual Desktop Switcher (taskbar-vd-switcher).

Injects a grid of numbered buttons into the system tray — one per virtual desktop — for direct switching without opening Task View. Buttons auto-arrange into rows based on taskbar height and update live as desktops are added, removed, or switched.

Features

  • Five placement positions within SystemTrayFrameGrid (after clock, before clock, before OmniButton, before notification icons, after Show Desktop)
  • Auto-sizing grid — row count detected from taskbar height, or set manually
  • Live updates via IVirtualDesktopNotificationService — highlighting, button count, and desktop names all update without restart
  • Tooltips — hover shows the desktop's display name (read from registry Desktops\{GUID}\Name, falls back to "Desktop N")
  • Label formats — numbers, roman numerals, filled/empty dots, or custom comma-separated labels
  • Full visual customization — active/inactive background color, text color, font size, corner radius, opacity, shine gradient, border color/thickness, padding, bold active label
  • Hide when single — optionally suppress the bar when only one desktop exists

Technical notes

  • Hooks IconView::IconView from Taskbar.View.dll for injection timing (pattern from vertical-omnibutton)
  • SystemTrayFrameGrid uses Grid column layout; injection inserts a ColumnDefinition and shifts existing element columns rather than relying on Children insertion order
  • SwitchToDesktop uses COM vtable calls with build-specific IIDs (pattern from taskbar-empty-space-clicks)
  • Registry reading for desktop state from session-scoped VirtualDesktopIDs / CurrentVirtualDesktop (pattern from taskbar-desktop-indicator)
  • Supports explorer builds 22000–26100+

🤖 Generated with Claude Code

sb4ssman and others added 5 commits April 28, 2026 13:16
Injects a grid of clickable buttons into the system tray — one per
virtual desktop — for direct switching without Task View.

Features:
- Auto-sizing grid (rows detected from taskbar height)
- Five placement positions within SystemTrayFrameGrid
- Live highlight updates via IVirtualDesktopNotificationService
- Buttons appear/disappear as desktops are added or removed
- Tooltips show Windows desktop display names (from registry)
- Configurable colors, font, opacity, corner radius, border, shine,
  padding, label format (numbers / roman / dots / custom)
- Hide when only one desktop exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
taskbarDllHooks for taskbar.dll
taskbarViewDllHooks for Taskbar.View.dll (two sites)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rays

The validator can't infer the dotted filename from the variable name;
explicit comments are required per the validation script's guidance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename taskbarViewDllHooks -> taskbarViewHooks. The module is identified
by the // Taskbar.View.dll comment; variable name should not also encode
it per Windhawk validator rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reference three screenshots from the lab repo via GitHub raw URLs,
showing default taskbar, tall taskbar (auto-rows), and multi-mod setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread mods/taskbar-vd-switcher.wh.cpp Outdated
if (_wcsicmp(base, L"Taskbar.View.dll") == 0) {
// Taskbar.View.dll
WindhawkUtils::SYMBOL_HOOK taskbarViewHooks[] = {{
{LR"(public: __cdecl winrt::SystemTray::implementation::IconView::IconView(void))"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In newer builds, this function was moved to SystemTray.dll, see:
#3926

Some mods were updated to support both older and newer builds. Please consider updating your mod as well.

@m417z

m417z commented May 1, 2026

Copy link
Copy Markdown
Member

Thanks for the submission, great mod.

Two things I noticed in a quick test session:

  1. Sometimes only half of the button is clickable, see video below
  2. Disabling the mod crashes explorer
neEeoBjdAh.mp4

Comment thread mods/taskbar-vd-switcher.wh.cpp Outdated
Comment thread mods/taskbar-vd-switcher.wh.cpp Outdated
Comment thread mods/taskbar-vd-switcher.wh.cpp Outdated
@sb4ssman

sb4ssman commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I will investigate.

New features:
- Grid layout controls: fill order (column-first/row-first), fixed rows/columns/grid modes, smart layout variants (balanced/pack vertical/pack horizontal)
- Short group alignment: center/end/start for partial last column or row
- Master button: optional Task View launcher, placed as a column (before/after) or sliver row (top/bottom), with configurable width/height
- Label formats: roman numerals, dot indicators, custom comma-separated labels
- Active bold, per-state text colors, shine effect, border thickness/color, corner radius

Bug fixes:
- Crash on mod disable: replaced unsafe RunAsync retry with WaitForSingleObject stop-event pattern
- Buttons persisting after disable: DoUninitRemove now walks the live XAML tree by name
- Short column vertical centering: use RowSpan + Margin.Top instead of integer row offset
- Sliver row shifts buttons: Margin compensation restores vertical center alignment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Salyts

Salyts commented May 2, 2026

Copy link
Copy Markdown
Contributor

@sb4ssman, Great mod. How about adding the options “Next to the Start button” and “Above the Start button” to the position settings? It would look great with the “Hide Start button” mod enabled.

@sb4ssman

sb4ssman commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@sb4ssman, Great mod. How about adding the options “Next to the Start button” and “Above the Start button” to the position settings? It would look great with the “Hide Start button” mod enabled.

Thank you! I haven't have much time to spend on mods, but I think I've got settings that will let you achieve the effect you want. Working on getting it polished and published.

Refine the submitted VDS mod for the current review pass:

- harden taskbar XAML discovery across SystemTray.dll, Taskbar.View.dll, and ExplorerExtensions.dll

- defer injection until tray XAML is loaded and clean up Loaded revokers on unload

- make notification-thread shutdown pump sent messages to avoid unload deadlocks/crashes

- move desktop switching off the UI thread to avoid click-time XAML reentrancy

- add Start-adjacent placement modes and master-button/grid layout refinements

- reduce repeated layout logging during Start-overlay positioning
@sb4ssman

Copy link
Copy Markdown
Contributor Author

Updated the PR branch with v1.5.

This pass addresses the earlier stability/clickability concerns and adds the requested Start-area placement options:

  • hardened injection timing so the tray XAML is loaded before modifying it
  • improved unload/settings-change cleanup for notification threads and WinRT revokers
  • moved desktop switching work off the taskbar UI thread to avoid reentrant XAML updates during clicks
  • added Start-adjacent modes: left of Start, over Start, and right of Start with reserved space
  • added the master button/sliver layout options and tightened grid positioning/logging

Annotate the multi-module SystemTray hook array and rename the local hook variable so pr_validation.py can identify the target modules.
@m417z

m417z commented Jun 17, 2026

Copy link
Copy Markdown
Member

The non-clickable buttons are still an issue: #3932 (comment).

I can merge it without the fix, but getting it fixed in a future update will be nice.

@sb4ssman

Copy link
Copy Markdown
Contributor Author

Moving the mouse away and back seems to relieve it. Fixing it is a priority. I've got a few more mods on deck too.

@m417z m417z merged commit 5e4d697 into ramensoftware:main Jun 17, 2026
3 checks passed
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.

3 participants