fix(windows): show the new launcher icon after an update, not Explorer's old one #334

Merged
HumanBean merged 1 commit from llun/LongshotLauncher:fix/launcher-icon-after-update into main 2026-11-28 05:43:11 +00:00
Member

After updating from the old .NET launcher to the Rust launcher, Windows kept showing the old green hookshot for the running launcher's taskbar button, although the new LongshotLauncher.exe embeds the new logo. Every shortcut's icon is LongshotLauncher.exe,0, and Explorer keeps the icon it last read for that path until it is told the file changed. An update puts the new launcher at the same path and never tells it.

Why the taskbar showed the old icon

Looked at on an updated PC (nightly-223, from the .NET launcher):

  • The installed exe's icon resource is the new logo, and so is the window's small icon (WM_GETICON). The window sets no big icon, and the process's AppUserModelID is MagicBean.LongshotLauncher.
  • The taskbar resolves that ID to the Start menu's Longshot Launcher shortcut (same ID), whose icon is LongshotLauncher.exe,0. Explorer's image for that path was still the .NET exe's.
  • register() had already run after the update (the uninstall entry's DisplayVersion was the new nightly) and rewritten the shortcuts. They were identical, though, and nothing told the shell.
  • Setting the window's big icon by hand (WM_SETICON ICON_BIG, from the exe's own resource) did not change the button. The resolved app's icon wins over the window's, so a window-icon change alone would not fix this.

What changed

  • update/shortcuts.rs: refresh_icons tells the shell that the launcher's exe and the shortcuts that start it changed (SHChangeNotify(SHCNE_UPDATEITEM)). That covers the launcher's Start menu entry, the game's desktop and Start menu entries, and any item pinned to the taskbar whose target is the launcher. It then sends SHCNE_ASSOCCHANGED, so Explorer drops the icons it holds. A shortcut counts only if it starts this exe (owns). The icon cache on disk is never touched.
  • update/windows.rs: register() calls it where it already rewrites the shortcuts, which is on install and on the first start of a new version. So it runs once per update, not on every start.
  • AppUserModelIDs, shortcut paths and icon locations are unchanged, so pinned items keep grouping with the window.

Testing

The taskbar button before and after is in the first comment.

  • On Windows 11 (25H2), on the PC that showed the bug. The old green hookshot was still on the taskbar button with nightly-223 running. I installed this branch through the launcher's own --install path, which replaces the exe and runs register() as an update does. Right after, the taskbar button and the desktop Longshot shortcut showed the new logo. I then put the original nightly-223 back the same way, and the new icon stayed. The shortcuts and the uninstall entry were backed up first, and no game installation was touched.
  • New test icons_refresh_only_on_shortcuts_that_start_the_launcher: among real .lnk files in a temp folder, only the one that starts the launcher is refreshed. One for another program, a non-shortcut and a missing file are left alone.
  • cargo fmt --check, locked Clippy with -D warnings, and all 46 Tooling release tests (test_release.py) passed.
  • cargo test --locked: 182 passed, 3 ignored, 10 failed. The same 10 fail on main on this PC (181 passed there; the extra one is the new test): folders, Steam library, recovery, registry, home and storage tests, none in code this touches.
  • pre-commit (file checks, gitleaks, Conventional Commit) passed.

Not verified: the Start menu entry's icon by eye. Start keeps its own view, and on this PC it is in category view, where a click starts the app. It reads the same shortcut, though.

Risks

Small. Two shell notifications, once per launcher update. SHCNE_ASSOCCHANGED makes Explorer reload the icons it shows, so the desktop may redraw once. A revert brings back the stale icon after the next update.

For players who see the old icon now

The next launcher update with this change fixes it on its own. Until then, signing out and back in (or restarting Explorer) shows the new icon.

πŸ€– Generated with Claude Code

After updating from the old .NET launcher to the Rust launcher, Windows kept showing the old green hookshot for the running launcher's taskbar button, although the new `LongshotLauncher.exe` embeds the new logo. Every shortcut's icon is `LongshotLauncher.exe,0`, and Explorer keeps the icon it last read for that path until it is told the file changed. An update puts the new launcher at the same path and never tells it. ## Why the taskbar showed the old icon Looked at on an updated PC (nightly-223, from the .NET launcher): - The installed exe's icon resource is the new logo, and so is the window's small icon (`WM_GETICON`). The window sets no big icon, and the process's AppUserModelID is `MagicBean.LongshotLauncher`. - The taskbar resolves that ID to the Start menu's *Longshot Launcher* shortcut (same ID), whose icon is `LongshotLauncher.exe,0`. Explorer's image for that path was still the .NET exe's. - `register()` had already run after the update (the uninstall entry's `DisplayVersion` was the new nightly) and rewritten the shortcuts. They were identical, though, and nothing told the shell. - Setting the window's big icon by hand (`WM_SETICON ICON_BIG`, from the exe's own resource) did not change the button. The resolved app's icon wins over the window's, so a window-icon change alone would not fix this. ## What changed - `update/shortcuts.rs`: `refresh_icons` tells the shell that the launcher's exe and the shortcuts that start it changed (`SHChangeNotify(SHCNE_UPDATEITEM)`). That covers the launcher's Start menu entry, the game's desktop and Start menu entries, and any item pinned to the taskbar whose target is the launcher. It then sends `SHCNE_ASSOCCHANGED`, so Explorer drops the icons it holds. A shortcut counts only if it starts this exe (`owns`). The icon cache on disk is never touched. - `update/windows.rs`: `register()` calls it where it already rewrites the shortcuts, which is on install and on the first start of a new version. So it runs once per update, not on every start. - AppUserModelIDs, shortcut paths and icon locations are unchanged, so pinned items keep grouping with the window. ## Testing The taskbar button before and after is in the first comment. - **On Windows 11 (25H2), on the PC that showed the bug.** The old green hookshot was still on the taskbar button with nightly-223 running. I installed this branch through the launcher's own `--install` path, which replaces the exe and runs `register()` as an update does. Right after, the taskbar button and the desktop *Longshot* shortcut showed the new logo. I then put the original nightly-223 back the same way, and the new icon stayed. The shortcuts and the uninstall entry were backed up first, and no game installation was touched. - New test `icons_refresh_only_on_shortcuts_that_start_the_launcher`: among real `.lnk` files in a temp folder, only the one that starts the launcher is refreshed. One for another program, a non-shortcut and a missing file are left alone. - `cargo fmt --check`, locked Clippy with `-D warnings`, and all 46 Tooling release tests (`test_release.py`) passed. - `cargo test --locked`: 182 passed, 3 ignored, 10 failed. The same 10 fail on `main` on this PC (181 passed there; the extra one is the new test): folders, Steam library, recovery, registry, home and storage tests, none in code this touches. - pre-commit (file checks, gitleaks, Conventional Commit) passed. **Not verified:** the Start menu entry's icon by eye. Start keeps its own view, and on this PC it is in category view, where a click starts the app. It reads the same shortcut, though. ## Risks Small. Two shell notifications, once per launcher update. `SHCNE_ASSOCCHANGED` makes Explorer reload the icons it shows, so the desktop may redraw once. A revert brings back the stale icon after the next update. ## For players who see the old icon now The next launcher update with this change fixes it on its own. Until then, signing out and back in (or restarting Explorer) shows the new icon. πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
fix(windows): show the new launcher icon after an update, not Explorer's old one
Some checks are pending
CI / What the change needs (pull_request) Successful in 6s
CI / Rust formatting, lint and tests (pull_request) Waiting to run
CI / Release packages and stable upgrades (pull_request) Waiting to run
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 9s
PR title / Conventional Commit title (pull_request) Successful in 5s
4af119c129
An update puts the new LongshotLauncher.exe at the same path, and every
shortcut's icon is that path's icon 0. Explorer keeps the icon it read for
the path, so after the update from the .NET launcher the taskbar button (the
window's AppUserModelID resolves to the Start menu entry), the Start menu
and the desktop kept showing the old green hookshot, although the new exe
embeds the new logo.

After an update, registration now tells the shell that the program and the
shortcuts that start it changed (SHCNE_UPDATEITEM: the launcher's Start menu
entry, the game's desktop and Start menu entries, items pinned to the
taskbar) and to drop the icons it holds (SHCNE_ASSOCCHANGED). The icon cache
on disk is left alone, and the AppUserModelIDs are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

The running launcher's taskbar button on Windows 11 on the PC that showed the bug: before, with nightly-223 after the update from the .NET launcher; after, once this branch's update path ran. Taskbar before and after

The running launcher's taskbar button on Windows 11 on the PC that showed the bug: before, with nightly-223 after the update from the .NET launcher; after, once this branch's update path ran. ![Taskbar before and after](https://git.magicbean.dev/attachments/3e2300de-eaaf-4647-ad82-cef497d7dd56)
Member

Possibly related, for context:

  • issue #203 Idea: let players choose a custom launcher or game icon for Steam β€” Related icon customization request, but this fixes stale cached icons rather than adding customization
  • PR #321 fix(launcher): refresh local installations and keep upgrades connected β€” Merged upgrade work also refreshes shortcuts after executable changes; this PR specifically adds Windows shell icon-cache notifications
Possibly related, for context: - issue #203 Idea: let players choose a custom launcher or game icon for Steam β€” Related icon customization request, but this fixes stale cached icons rather than adding customization - PR #321 fix(launcher): refresh local installations and keep upgrades connected β€” Merged upgrade work also refreshes shortcuts after executable changes; this PR specifically adds Windows shell icon-cache notifications
llun changed title from WIP: fix(windows): show the new launcher icon after an update, not Explorer's old one to fix(windows): show the new launcher icon after an update, not Explorer's old one 2026-11-28 05:41:50 +00:00
Author
Member
@review
HumanBean deleted branch fix/launcher-icon-after-update 2026-11-28 05:43:11 +00:00
BeanBot left a comment

Recommendation: Approve. The reported Windows test shows the taskbar and desktop icons changing to the new logo. The CI checks are still running. Nothing blocking is left. Recommend approval; not approved on the forge.

The launcher tells Explorer to refresh its executable and owned shortcuts during registration after an update. This targets the stale icon with a one-time shell refresh, at the cost of a possible desktop redraw.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • src/update/shortcuts.rs:205: Is there a case where the notification path fails in the current code despite this test passing?

Checks: Still running: CI / Rust formatting, lint and tests (pull_request), CI / Release packages and stable upgrades (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports that the taskbar button and desktop shortcut changed to the new logo on the affected Windows 11 PC after installing this branch. The Start menu icon was not visually verified.

Other systems: The changed code is Windows-only. It also notifies Explorer about owned game shortcuts and taskbar pins; the reported run covers the desktop shortcut but does not establish the result for pins or the Start menu.

Switches: None.

Reviewed: 4af119c129 against 8941492718: Read AGENTS.md, CONTRIBUTING.md, the commit and both changed files in full; inspected the update startup and registration callers and rechecked both diffs. Skimmed the surrounding update module and test configuration. No review checklist or pull request template was present; the linked screenshot was not accessible in the closed network.; nothing run (a code review).

Checked and fine:

  • The commit has the required AI co-author trailer and contains no game-derived files.
  • Shortcut targets are checked before individual shortcut notifications, and Windows paths are passed as wide strings.
  • Registration calls the refresh on installation or a changed registered version.

Testing: Read-only review; no code or tests were run. The author reports the Windows manual test, formatting, Clippy and release tests; the two CI checks remain in progress.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Windows test shows the taskbar and desktop icons changing to the new logo. The CI checks are still running. Nothing blocking is left. Recommend approval; not approved on the forge. The launcher tells Explorer to refresh its executable and owned shortcuts during registration after an update. This targets the stale icon with a one-time shell refresh, at the cost of a possible desktop redraw. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `src/update/shortcuts.rs:205`: Is there a case where the notification path fails in the current code despite this test passing? **Checks:** Still running: `CI / Rust formatting, lint and tests (pull_request)`, `CI / Release packages and stable upgrades (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports that the taskbar button and desktop shortcut changed to the new logo on the affected Windows 11 PC after installing this branch. The Start menu icon was not visually verified. **Other systems:** The changed code is Windows-only. It also notifies Explorer about owned game shortcuts and taskbar pins; the reported run covers the desktop shortcut but does not establish the result for pins or the Start menu. **Switches:** None. **Reviewed:** 4af119c12964 against 894149271825: Read AGENTS.md, CONTRIBUTING.md, the commit and both changed files in full; inspected the update startup and registration callers and rechecked both diffs. Skimmed the surrounding update module and test configuration. No review checklist or pull request template was present; the linked screenshot was not accessible in the closed network.; nothing run (a code review). **Checked and fine:** - The commit has the required AI co-author trailer and contains no game-derived files. - Shortcut targets are checked before individual shortcut notifications, and Windows paths are passed as wide strings. - Registration calls the refresh on installation or a changed registered version. **Testing:** Read-only review; no code or tests were run. The author reports the Windows manual test, formatting, Clippy and release tests; the two CI checks remain in progress. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!334
No description provided.