Skip to content

fix(windows): give windows an icon and register Arto as a document handler - #208

Merged
lambdalisue merged 1 commit into
mainfrom
fix/windows-icon-and-file-associations
Aug 1, 2026
Merged

fix(windows): give windows an icon and register Arto as a document handler#208
lambdalisue merged 1 commit into
mainfrom
fix/windows-icon-and-file-associations

Conversation

@lambdalisue

Copy link
Copy Markdown
Member

Two gaps in the Windows integration, both invisible on macOS because the app bundle covers them there.

No window icon

tao registers its window class with a null hIcon and only sends WM_SETICON when a window icon is supplied. Arto never supplied one, so the title bar, taskbar and Alt+Tab switcher all fell back to the generic placeholder. The icon dx links into the executable covers Explorer only, not the running window.

Every WindowBuilder — the main window plus the Mermaid, Math and Image viewers — now carries the embedded Arto.png via the new window::icon module. Two details worth noting:

  • On Windows the builder icon fills the small (title bar) slot only. The taskbar and Alt+Tab read the big slot, which tao exposes solely through WindowBuilderExtWindows::with_taskbar_icon, so it is set separately.
  • Windows scales icons without smoothing, so the 500×500 source is pre-scaled to 32px and 256px with Lanczos3 rather than handed over at full size.

macOS has no per-window icons and ignores all of this; its icon still comes from the bundle.

Not offered for Markdown files

The NSIS script dx renders installs the binary, shortcuts and an uninstaller and nothing else, and dx's bundle config has no file_associations setting to fill the gap. Windows therefore never learned that Arto opens documents: it was absent from a .md file's "Open with" menu, from the "Choose another app" dialog, and from Settings → Apps → Default apps.

[bundle.windows.nsis] installer_hooks now points at extras/windows/file-associations.nsh, which writes:

  • ProgIDs Arto.Markdown and Arto.Text (display name, icon, open verb)
  • the per-executable Applications\arto.exe entry with FriendlyAppName and SupportedTypes — what the "Choose another app" dialog reads
  • OpenWithProgids candidates per extension
  • a Capabilities key plus RegisteredApplications, which Settings → Default apps requires

Extensions match what the macOS Info.plist declares: .md, .markdown, .txt, .text. Registration only adds Arto as a candidate — it does not take the file type over from whatever the user already has. Everything is written under SHCTX, the same hive as the Add/Remove Programs entry the template writes, and the uninstaller removes it symmetrically.

Verification

  • just fmt check test passes (142 + 5 tests).
  • The NSIS hook was syntax-checked with the same makensis dx downloads (nsis-3.11), embedded in a stand-in for the generated template: compiles with no warnings, 2 install and 2 uninstall sections.
  • The window icon was exercised by a real dx build --release --windows run and launch.

Not verified end-to-end: the file associations require building the NSIS installer and actually installing it, which this change has not done. Reviewers on Windows should confirm via just build → run the setup → right-click a .md file.

🤖 Generated with Claude Code

…ndler

Two gaps in the Windows integration, both absent on macOS because the app
bundle covers them.

No window icon: tao registers its window class with a null hIcon and only
sends WM_SETICON when a window icon is supplied, so the title bar, taskbar
and Alt+Tab all fell back to the generic placeholder. The icon dx links
into the executable only covers Explorer, not the running window. Every
WindowBuilder now carries the embedded Arto.png. On Windows the builder
icon fills the small (title bar) slot only, so the taskbar/Alt+Tab slot is
set separately through the platform extension trait, and both are
pre-scaled with Lanczos3 because Windows scales icons without smoothing.

Not offered for Markdown files: the NSIS script dx renders installs the
binary and nothing else, and dx has no file_associations setting to fill
the gap, so Windows never learned that Arto opens documents -- it was
missing from "Open with", from "Choose another app" and from Settings ->
Default apps. An installer hook now writes the ProgIDs, the per-executable
SupportedTypes entry, the OpenWithProgids candidates and the Capabilities
key, for the same extensions the macOS Info.plist declares. Registration
adds Arto as a candidate without taking the file type over, and the
uninstaller removes it symmetrically.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 1, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Windows desktop integration by ensuring Arto windows display a proper app icon at runtime and by registering Arto as a candidate handler for Markdown and text files via NSIS installer registry hooks.

Changes:

  • Add a shared window::icon helper that embeds and applies the app icon to all created windows (including child viewer windows), with Windows-specific small/taskbar icon handling.
  • Add an NSIS installer hook that registers ProgIDs, OpenWith candidates, SupportedTypes, and Default Apps “Capabilities” for .md, .markdown, .txt, .text.
  • Wire the NSIS hook into the Windows bundling configuration via desktop/Dioxus.toml.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extras/windows/file-associations.nsh Adds install/uninstall sections to register Arto as a document handler and Default Apps candidate on Windows.
desktop/src/window/main.rs Applies the embedded app icon to the main window builder.
desktop/src/window/icon.rs New module embedding and caching the icon PNG, with Windows taskbar icon support and decoding tests.
desktop/src/window/child.rs Applies the embedded app icon to Mermaid/Math/Image viewer windows.
desktop/src/window.rs Exposes the new icon module.
desktop/Dioxus.toml Configures Windows NSIS installer_hooks to include the registry registration script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lambdalisue
lambdalisue merged commit 96f3783 into main Aug 1, 2026
16 checks passed
@lambdalisue
lambdalisue deleted the fix/windows-icon-and-file-associations branch August 1, 2026 07:43
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.

2 participants