Skip to content

[ZoomIt] Theme-aware system-tray menu + a reusable helper for tray utilities#48755

Draft
crutkas wants to merge 1 commit into
mainfrom
dev/crutkas/ZoomItSysTray
Draft

[ZoomIt] Theme-aware system-tray menu + a reusable helper for tray utilities#48755
crutkas wants to merge 1 commit into
mainfrom
dev/crutkas/ZoomItSysTray

Conversation

@crutkas

@crutkas crutkas commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

Makes ZoomIt's system-tray context menu correctly follow the OS light/dark theme (including live theme switches), and factors the logic into a small reusable helper that any PowerToys system-tray utility can adopt.

Screenshots

ZoomIt tray context menu following the OS theme — Dark (top) and Light (bottom):

Why

Several PowerToys Win32 utilities have classic system-tray context menus, and the light/dark handling tends to be re-implemented per module (or missing). This PR fixes it for ZoomIt and introduces one shared, tested helper so other tray utilities can get the same behavior in a single call — and drop their own copies.

Reusable helper — src/common/Themes/dark_menu.h (header-only)

  • SetAppMode(bool dark) — render this process's popup menus dark or light.
  • IsSystemDarkMode() — current app theme from the documented AppsUseLightTheme value, read fresh.
  • Drop-in:
    theme::dark_menu::SetAppMode(theme::dark_menu::IsSystemDarkMode());
    TrackPopupMenu(menu, ...);
  • Header-only — no project/linker wiring; a module just #include <common/Themes/dark_menu.h>.

ZoomIt (first adopter)

  • Tray menu now follows Light/Dark and updates live on a theme switch with no restart (runtime switches weren't picked up before).
  • The OS draws the real themed menu — native keyboard, accessibility, checkmarks, separators and DPI; only the colors change.
  • Standalone (non-PowerToys) build is unchanged (guarded by __ZOOMIT_POWERTOYS__).

Follow-up

Once this lands, a follow-up will adopt the helper in the other system-tray utilities (e.g. the runner tray menu) and remove their duplicate theme handling.

Testing

  • MSBuild src\modules\ZoomIt\ZoomIt\ZoomIt.vcxproj /p:Configuration=Release /p:Platform=x64 /m0 warnings, 0 errors.
  • Verified on Windows 11: tray menu in Light, in Dark, and a live Light↔Dark switch (menu follows without restart).

Makes ZoomIt's system-tray context menu follow the OS light/dark theme,
including live theme switches, and factors the logic into a small reusable
helper that any PowerToys system-tray utility can adopt.

src/common/Themes/dark_menu.h (header-only):
  - SetAppMode(bool dark): render this process's popup menus dark or light.
  - IsSystemDarkMode(): current app theme via the documented AppsUseLightTheme
    value, read fresh so a live light<->dark switch is reflected.
Drop-in for any Win32 tray utility:
  theme::dark_menu::SetAppMode(theme::dark_menu::IsSystemDarkMode());
  TrackPopupMenu(menu, ...);

ZoomIt (first adopter): the tray menu now follows Light/Dark and updates live
on a theme switch without restarting. The OS renders the real themed menu, so
native keyboard, accessibility, checkmarks, separators and DPI are preserved --
only the colors change. The standalone (non-PowerToys) build is unchanged,
under the existing __ZOOMIT_POWERTOYS__ guard.

Testing: MSBuild src\modules\ZoomIt\ZoomIt\ZoomIt.vcxproj /p:Configuration=Release
/p:Platform=x64 /m -- 0 warnings, 0 errors. Verified Light, Dark, and a live
theme switch on Windows 11.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Product-ZoomIt Refers to the ZoomIt tool label Jun 19, 2026
@crutkas crutkas marked this pull request as draft June 20, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-ZoomIt Refers to the ZoomIt tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant