Skip to content

Set the Windows title-bar icon from the embedded exe resource - #284

Merged
turinglambdaai merged 1 commit into
mainfrom
fix/windows-titlebar-icon
Oct 17, 2026
Merged

turinglambdaai merged 1 commit into
mainfrom
fix/windows-titlebar-icon

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Problem

Every rivet Windows app runs with WinUI's generic placeholder icon in the title bar, while the taskbar, Alt-Tab and shortcuts show the real brand icon. Found while triaging podlens: the exe correctly carries the project icon (embedded by rivet-cli/build.rkt at resource ID 1 since #283), but nothing ever loaded it into the AppWindow — WinUI only uses the exe icon for the taskbar; the title bar needs an explicit AppWindow.SetIcon.

Screenshot before (podlens, title bar at 16px): the slot left of the title shows WinUI's teal default glyph.

Fix

The host template's MainWindow constructor now loads the embedded icon and hands it to the window:

if (HICON const icon =
        ::LoadIconW(::GetModuleHandleW(nullptr), MAKEINTRESOURCEW(1))) {
  AppWindow().SetIcon(winrt::Microsoft::UI::IconId{
      static_cast<std::uint64_t>(reinterpret_cast<UINT_PTR>(icon))});
}
  • Uses the IconId overload, so no icon file needs to ship beside the exe (no resources staging needed).
  • Null guard: projects without a windows-icon declaration keep the placeholder.
  • Verified end to end in podlens (built with the linked checkout at a701e35): the title bar now shows the terracotta brand tile; podlens landed the same lines in its own MainWindow (de7149e) as the first existing product.

Existing products (taskly, payback, movebit, …) carry their own generated MainWindow.xaml.cpp and need the same lines; the template fix covers all newly scaffolded hosts.

Testing

  • raco test rivet/tests/ (no Racket-side change expected)
  • Compiled and run in podlens against the linked checkout; title-bar icon verified visually at native resolution.

…plate

WinUI shows a generic placeholder in the title bar unless the window is
handed an icon explicitly, so hosts ran with a foreign default glyph
while taskbar and shortcuts showed the real brand icon: the icon was
compiled into the exe at resource ID 1 (87cba77) but nothing loaded it.
The host template now loads it with LoadIconW and hands it to
AppWindow.SetIcon at construction; projects without a windows-icon
declaration keep the placeholder.
@turinglambdaai
turinglambdaai merged commit bcbb740 into main Oct 17, 2026
23 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.

1 participant