Skip to content

fix(tray): the menu on Windows follows dark mode - #259

Merged
7schmiede merged 1 commit into
mainfrom
fix/tray-dark-menu
Oct 23, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/tray-dark-menu

Conversation

@7schmiede

Copy link
Copy Markdown
Member

The tray's popup menu on Windows was light with the system's apps set to dark (seen on 0.21.0, Windows 11).

Win32 menus are light unless the app opts in, and there is no documented API for it. uxtheme.dll exports by ordinal only:

  • 135 SetPreferredAppMode(AllowDark) (AllowDarkModeForApp(true) on 1809, same argument),
  • 133 AllowDarkModeForWindow(hwnd, true) on the tray's hidden window, which owns the menu,
  • 136 FlushMenuThemes.

dark_menus calls them at start and again on WM_SETTINGCHANGE "ImmersiveColorSet", so a change of mode while the tray runs is followed. Where an ordinal is missing (before Windows 10 1809) nothing is called and the menu stays light. Light mode stays light: AllowDark follows the system, it does not force dark.

Checked: cargo clippy -p devstack-desktop --all-targets --target x86_64-pc-windows-msvc, cargo fmt.
Not checked: run on Windows (dark and light mode, a switch while it runs). Needed before 0.22.0.

🤖 Generated with Claude Code

Win32 popup menus are light unless the app opts in, and Windows has no
documented API for it: uxtheme.dll's ordinals 135 (SetPreferredAppMode,
AllowDark), 133 (AllowDarkModeForWindow) and 136 (FlushMenuThemes), as
Explorer and other programs with dark menus use them. Called at start and on
WM_SETTINGCHANGE "ImmersiveColorSet"; where one is missing (before 1809)
the menu stays light.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit af2c0d9 into main Oct 23, 2026
13 checks passed
@7schmiede
7schmiede deleted the fix/tray-dark-menu branch October 23, 2026 22:17
@7schmiede 7schmiede mentioned this pull request Oct 23, 2026
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.

1 participant