Skip to content

fix(desktop): correct Windows tray icon theme and DPI rendering - #791

Merged
AbirAbbas merged 2 commits into
mainfrom
fix/desktop-windows-tray-icon
Jul 17, 2026
Merged

fix(desktop): correct Windows tray icon theme and DPI rendering#791
AbirAbbas merged 2 commits into
mainfrom
fix/desktop-windows-tray-icon

Conversation

@AbirAbbas

Copy link
Copy Markdown
Contributor

Summary

The Windows tray icon looked washed-out and blurry — it read as the gray "offline" glyph even while the control plane was running. Two independent rendering bugs, both Windows-specific:

  • Wrong theme signal. The glyph variant was picked from nativeTheme.shouldUseDarkColors, which on Windows tracks the apps theme. The taskbar follows the separately-configurable system theme. With mixed themes (dark taskbar + light apps is a common Windows setup) the tray wore a near-black glyph on a dark taskbar — effectively invisible, reading as the inactive/offline icon.
  • Upscaled 16px bitmap. The tray image was built from 1x/1.5x/2x PNG representations, but the Windows tray ignores scale-factor representations ([Feature Request]: Support for high DPI variations in tray & window icons electron/electron#33044) and the shell upscales the 16px bitmap on >100% displays — fuzzy at the 125–150% scaling most Windows laptops run.

Changes

  • tray-model.ts: new darkTaskbar() helper picks the theme source per platform — shouldUseDarkColorsForSystemIntegratedUI (the system/taskbar theme) on win32, shouldUseDarkColors elsewhere. Pure function, unit-tested.
  • tray.ts: on win32, load the tray image with nativeImage.createFromPath(<ico>) so Electron serves a DPI-correct frame (it only does this for path-loaded .ico); Linux keeps the PNG-representation path. The 5s poll now re-checks the taskbar theme too, since Windows doesn't reliably emit nativeTheme updated when only the system theme flips; the icon/menu still only re-render on actual change.
  • make-icons.mjs: emits one multi-size .ico per tray variant (16/20/24/32/48 frames; 20 covers 125% scaling), mirroring the existing icns builder. The four generated .ico files are committed alongside the existing PNGs.

Packaged builds need no electron-builder changes: Electron's ReadICOFromPath extracts asar-packed icos to a temp file before the Win32 LoadImage call.

Test plan

  • npm run typecheck, npm test (223 passing, incl. new darkTaskbar contract tests: dark taskbar + light apps → light glyph, and vice versa)
  • All four .ico files parse as well-formed 5-frame icons with matching directory/IHDR dimensions
  • npm run dist:dir packages successfully; app.asar contains the icos
  • Manually verified on Windows 11: gold-dot glyph shows while the control plane is running, matches the taskbar theme, and is crisp at >100% scaling

🤖 Generated with Claude Code

AbirAbbas and others added 2 commits July 17, 2026 11:30
The Windows tray ignores PNG scale-factor representations
(electron/electron#33044) and upscales the 16px bitmap on >100% displays,
so make-icons.mjs now also emits one .ico per tray variant with
16/20/24/32/48 frames (20 covers the common 125% scaling). The PNGs stay
for the Linux representation path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two fixes for the washed-out / blurry tray icon on Windows:

- Pick the light/dark glyph from the *system* (taskbar) theme via
  nativeTheme.shouldUseDarkColorsForSystemIntegratedUI instead of
  shouldUseDarkColors, which tracks the separately-configurable *apps*
  theme. With mixed themes (dark taskbar + light apps is common) the
  tray wore a near-invisible glyph that read as the offline icon. The
  poll re-checks the theme too, since Windows does not reliably emit
  nativeTheme 'updated' for system-theme-only flips.
- Load the tray image from the multi-size .ico on win32 so Electron
  serves a DPI-correct frame; scale-factor PNG representations are
  ignored by the Windows tray (electron/electron#33044) and the 16px
  bitmap got upscaled on >100% displays.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AbirAbbas
AbirAbbas requested a review from a team as a code owner July 17, 2026 15:32
@AbirAbbas
AbirAbbas merged commit 6da0607 into main Jul 17, 2026
19 checks passed
@AbirAbbas
AbirAbbas deleted the fix/desktop-windows-tray-icon branch July 17, 2026 16:07
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