[PR #2625] [MERGED] launcher: desktop shortcut that plays an instance #4484

Closed
opened 2026-11-03 04:17:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2625
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-shortcuts


📝 Commits (1)

  • 82c8398 launcher: desktop shortcut that plays an instance

📊 Changes

12 files changed (+766 additions, -11 deletions)

View changed files

📝 AGENTS.md (+1 -1)
📝 docs/launcher-commands.md (+11 -0)
📝 launcher/README.md (+7 -0)
📝 launcher/src/cli.rs (+30 -0)
📝 launcher/src/desktop.rs (+2 -2)
📝 launcher/src/desktop_seams.rs (+4 -2)
📝 launcher/src/instances_page.rs (+13 -6)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/main.rs (+4 -0)
➕ launcher/src/shortcut.rs (+427 -0)
➕ launcher/src/shortcut/tests.rs (+197 -0)
➕ launcher/src/shortcut_page.rs (+69 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. The Windows shortcut follows Microsoft's published MS-SHLLINK format.

Launcher features, item 14: a desktop shortcut per instance, which runs play --instance. Stacked on #2623 (while playing).

  • Home's Instance row gets a Shortcut button. It changes to Remove shortcut once the instance has one, and a line under the row says what happened.
  • New horizon_launcher::shortcut. It writes the shortcut for each system, and every format can be written and tested on any of them:
    • Linux: <name> (Horizon).desktop on the desktop. It is executable and is marked trusted with gio set … metadata::trusted true where gio exists, because GNOME won't start an untrusted one. The same entry goes into the applications menu (applications/horizon-instance-<id>.desktop). Exec="<launcher>" play --instance "<id>", Icon=horizon (the icon desktop.rs already installs).
    • macOS: <name> (Horizon).app, a small bundle:
      • its program is a shell script, exec '<launcher>' play --instance '<id>';
      • it has Horizon's .icns;
      • LSUIElement is set, so the shortcut has no Dock icon of its own and the game's window is what appears.
    • Windows: <name> (Horizon).lnk, a Shell Link to the launcher's .exe:
      • a header and a LinkInfo with the path in ANSI and in UTF-16;
      • the description, the working folder, the arguments and the icon.
      • The launcher is a GUI-subsystem exe, so play opens no console.
  • Each shortcut has the instance id inside it, so Remove shortcut finds it after a rename:
    • Linux: X-Horizon-Instance=;
    • macOS: a HorizonInstance key in Info.plist;
    • Windows: the arguments.
  • Making it again rewrites it in place. After a rename, the old-name one goes to the trash.
  • Removing moves the shortcuts to the trash (through the trash seam), never deletes them. A file of the same name that isn't the instance's own is left alone, and the launcher says so.
  • CLI and MCP: horizon-launcher instance shortcut [instance] [--remove]. play --instance already existed.
  • HORIZON_LAUNCHER_DESKTOP points the desktop folder elsewhere. AGENTS.md's scratch-home rule now lists it beside the trash and clipboard vars.

Proof

  • fmt, clippy -D warnings and the launcher tests: clean and passing (173 + 36). The new tests cover:
    • file names on every system;
    • the Linux entry;
    • the macOS bundle (plist escaping, the script's quoting, the icon);
    • the .lnk read back field by field from its spec;
    • make, remake, rename and remove for all three systems in a scratch folder, plus refusing someone else's file.
  • .lnk checked with two independent readers:
    • LnkParse3 (in a throwaway venv) read the flags, SW_SHOWNORMAL, the fixed-drive VolumeID, the ANSI and Unicode paths (C:\Users\Zoé\…), and the description, folder, arguments and icon.
    • file reads it as "MS Windows shortcut, Points to a file or directory, Has Description string, Has Working directory, Has command line arguments".
    • Not run on a real Windows machine: none is allowed for this work.
  • macOS, scratch homes:
    • instance shortcut Skyblock made Skyblock (Horizon).app, and running it again rewrote it with nothing sent to the trash.
    • plutil -lint passes, Spotlight types it as com.apple.application-bundle, and its script started the game (exit 0).
    • A copy of the bundle, with a script that only writes a file, started through open. So LaunchServices runs this kind of bundle. The real one wasn't opened through open, because that would drop the scratch env.
    • In the window, Shortcut made Hardcore (Horizon).app for the instance hardcore, and Remove shortcut moved it into the scratch trash.
  • Linux (playhorizon, CPUs 0-3): the shortcut tests pass. The host couldn't link the launcher binary (a host linker issue, not this change), so no live .desktop there; the entry's text is covered by the unit test.
Made Removed

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2625 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-shortcuts` --- ### 📝 Commits (1) - [`82c8398`](https://github.com/horizon-rust/horizon/commit/82c8398c6b3ba361e5f57342e927fb7c94956af3) launcher: desktop shortcut that plays an instance ### 📊 Changes **12 files changed** (+766 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -1) 📝 `docs/launcher-commands.md` (+11 -0) 📝 `launcher/README.md` (+7 -0) 📝 `launcher/src/cli.rs` (+30 -0) 📝 `launcher/src/desktop.rs` (+2 -2) 📝 `launcher/src/desktop_seams.rs` (+4 -2) 📝 `launcher/src/instances_page.rs` (+13 -6) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/main.rs` (+4 -0) ➕ `launcher/src/shortcut.rs` (+427 -0) ➕ `launcher/src/shortcut/tests.rs` (+197 -0) ➕ `launcher/src/shortcut_page.rs` (+69 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. The Windows shortcut follows Microsoft's published [MS-SHLLINK] format. Launcher features, item 14: a desktop shortcut per instance, which runs `play --instance`. Stacked on #2623 (while playing). - **Home's Instance row** gets a **Shortcut** button. It changes to **Remove shortcut** once the instance has one, and a line under the row says what happened. - New `horizon_launcher::shortcut`. It writes the shortcut for each system, and every format can be written and tested on any of them: - **Linux:** `<name> (Horizon).desktop` on the desktop. It is executable and is marked trusted with `gio set … metadata::trusted true` where `gio` exists, because GNOME won't start an untrusted one. The same entry goes into the applications menu (`applications/horizon-instance-<id>.desktop`). `Exec="<launcher>" play --instance "<id>"`, `Icon=horizon` (the icon `desktop.rs` already installs). - **macOS:** `<name> (Horizon).app`, a small bundle: - its program is a shell script, `exec '<launcher>' play --instance '<id>'`; - it has Horizon's `.icns`; - `LSUIElement` is set, so the shortcut has no Dock icon of its own and the game's window is what appears. - **Windows:** `<name> (Horizon).lnk`, a Shell Link to the launcher's `.exe`: - a header and a LinkInfo with the path in ANSI and in UTF-16; - the description, the working folder, the arguments and the icon. - The launcher is a GUI-subsystem exe, so `play` opens no console. - Each shortcut has the instance id inside it, so **Remove shortcut** finds it after a rename: - Linux: `X-Horizon-Instance=`; - macOS: a `HorizonInstance` key in Info.plist; - Windows: the arguments. - Making it again rewrites it in place. After a rename, the old-name one goes to the trash. - Removing moves the shortcuts to the trash (through the trash seam), never deletes them. A file of the same name that isn't the instance's own is left alone, and the launcher says so. - CLI and MCP: `horizon-launcher instance shortcut [instance] [--remove]`. `play --instance` already existed. - `HORIZON_LAUNCHER_DESKTOP` points the desktop folder elsewhere. AGENTS.md's scratch-home rule now lists it beside the trash and clipboard vars. ## Proof - fmt, clippy `-D warnings` and the launcher tests: clean and passing (173 + 36). The new tests cover: - file names on every system; - the Linux entry; - the macOS bundle (plist escaping, the script's quoting, the icon); - the `.lnk` read back field by field from its spec; - make, remake, rename and remove for all three systems in a scratch folder, plus refusing someone else's file. - `.lnk` checked with two independent readers: - LnkParse3 (in a throwaway venv) read the flags, `SW_SHOWNORMAL`, the fixed-drive VolumeID, the ANSI and Unicode paths (`C:\Users\Zoé\…`), and the description, folder, arguments and icon. - `file` reads it as "MS Windows shortcut, Points to a file or directory, Has Description string, Has Working directory, Has command line arguments". - Not run on a real Windows machine: none is allowed for this work. - macOS, scratch homes: - `instance shortcut Skyblock` made `Skyblock (Horizon).app`, and running it again rewrote it with nothing sent to the trash. - `plutil -lint` passes, Spotlight types it as `com.apple.application-bundle`, and its script started the game (exit 0). - A copy of the bundle, with a script that only writes a file, started through `open`. So LaunchServices runs this kind of bundle. The real one wasn't opened through `open`, because that would drop the scratch env. - In the window, **Shortcut** made `Hardcore (Horizon).app` for the instance `hardcore`, and **Remove shortcut** moved it into the scratch trash. - Linux (playhorizon, CPUs 0-3): the shortcut tests pass. The host couldn't link the launcher binary (a host linker issue, not this change), so no live `.desktop` there; the entry's text is covered by the unit test. | Made | Removed | |---|---| | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/shortcut/made.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/shortcut/removed.png) | [MS-SHLLINK]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:30 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
horizon-rust/horizon#4484
No description provided.