[ZoomIt] Theme-aware system-tray menu + a reusable helper for tray utilities#48755
Draft
crutkas wants to merge 1 commit into
Draft
[ZoomIt] Theme-aware system-tray menu + a reusable helper for tray utilities#48755crutkas wants to merge 1 commit into
crutkas wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 documentedAppsUseLightThemevalue, read fresh.#include <common/Themes/dark_menu.h>.ZoomIt (first adopter)
__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 /m— 0 warnings, 0 errors.