fix(windows): show the new launcher icon after an update, not Explorer's old one #334
No reviewers
Labels
No labels
area/build
area/install
area/mods
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!334
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "llun/LongshotLauncher:fix/launcher-icon-after-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.exeembeds the new logo. Every shortcut's icon isLongshotLauncher.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):
WM_GETICON). The window sets no big icon, and the process's AppUserModelID isMagicBean.LongshotLauncher.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'sDisplayVersionwas the new nightly) and rewritten the shortcuts. They were identical, though, and nothing told the shell.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_iconstells 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 sendsSHCNE_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.Testing
The taskbar button before and after is in the first comment.
--installpath, which replaces the exe and runsregister()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.icons_refresh_only_on_shortcuts_that_start_the_launcher: among real.lnkfiles 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 onmainon 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.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_ASSOCCHANGEDmakes 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
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.
Possibly related, for context:
WIP: fix(windows): show the new launcher icon after an update, not Explorer's old oneto fix(windows): show the new launcher icon after an update, not Explorer's old one@review
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:
4af119c129against8941492718: 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:
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.