fix(windows): give windows an icon and register Arto as a document handler - #208
Merged
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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::iconhelper 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.
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.
Two gaps in the Windows integration, both invisible on macOS because the app bundle covers them there.
No window icon
taoregisters its window class with a nullhIconand only sendsWM_SETICONwhen 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 icondxlinks 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 embeddedArto.pngvia the newwindow::iconmodule. Two details worth noting:taoexposes solely throughWindowBuilderExtWindows::with_taskbar_icon, so it is set separately.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
dxrenders installs the binary, shortcuts and an uninstaller and nothing else, anddx's bundle config has nofile_associationssetting to fill the gap. Windows therefore never learned that Arto opens documents: it was absent from a.mdfile's "Open with" menu, from the "Choose another app" dialog, and from Settings → Apps → Default apps.[bundle.windows.nsis] installer_hooksnow points atextras/windows/file-associations.nsh, which writes:Arto.MarkdownandArto.Text(display name, icon, open verb)Applications\arto.exeentry withFriendlyAppNameandSupportedTypes— what the "Choose another app" dialog readsOpenWithProgidscandidates per extensionCapabilitieskey plusRegisteredApplications, which Settings → Default apps requiresExtensions match what the macOS
Info.plistdeclares:.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 underSHCTX, the same hive as the Add/Remove Programs entry the template writes, and the uninstaller removes it symmetrically.Verification
just fmt check testpasses (142 + 5 tests).makensisdxdownloads (nsis-3.11), embedded in a stand-in for the generated template: compiles with no warnings, 2 install and 2 uninstall sections.dx build --release --windowsrun 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.mdfile.🤖 Generated with Claude Code