[PR #2631] [MERGED] launcher: offline names and a quick switch of who plays #4487

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

📋 Pull Request Information

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

Base: main ← Head: feat/launcher-accounts


📝 Commits (1)

  • f1f34ed launcher: offline names and a quick switch of who plays

📊 Changes

9 files changed (+469 additions, -32 deletions)

View changed files

📝 docs/launcher-commands.md (+15 -3)
📝 launcher/README.md (+7 -0)
📝 launcher/src/account.rs (+95 -0)
📝 launcher/src/account/tests.rs (+40 -0)
📝 launcher/src/cli.rs (+52 -12)
📝 launcher/src/game_log.rs (+5 -7)
📝 launcher/src/main.rs (+19 -9)
📝 launcher/src/servers_page.rs (+5 -1)
➕ launcher/src/switch_page.rs (+231 -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.

Launcher features, item 17: several accounts and a quick switch. Stacked on #2627 (Linux switches).

Several Microsoft accounts already worked (sign in again for another, then "Play as"). Microsoft sign-in itself is still "coming soon" in releases (it needs the Azure and Mojang approval). Until then, what players can actually switch between is offline names, so this adds those and one place to switch.

  • Quick switch: the top bar's account chip used to jump to Settings. Now it opens a menu of everyone who can play:
    • each signed-in Microsoft account;
    • the offline names the player keeps;
    • the name the game made up (horizon-player.txt);
    • a dot on the one that plays, and Manage accounts at the bottom.
    • Picking one plays as it from the next Play. The chip shows the name and "Microsoft account" or "Offline".
  • Settings > Account: a row per offline name with Play as and Forget, then a field to add one.
    • An offline name is 3 to 16 letters, digits or _, like an account name.
    • Names are kept once, whatever the case.
  • accounts.json gains offline (the names) and offline_selected. An older file reads as before and is written back unchanged until a name is added.
  • The game gets --name <offline name> from the window's Play and from play, only when no Microsoft account is selected. A Microsoft account always plays with its own name.
  • Share log (#2622) also strips the offline names.
  • CLI and MCP:
    • account offline [NAME]: plays offline as NAME (kept), or as the game's name without one.
    • account select <name>: finds accounts and offline names.
    • account forget-offline <name>.
    • account lists both. The JSON has an offline array.
  • launcher/README.md: an Accounts bullet.

Proof

  • fmt, clippy -D warnings and the launcher tests: clean and passing (181 + 36). The new test covers:
    • switching between an account, offline names and the game's name;
    • --name only when offline;
    • once-per-name in any case;
    • invalid names;
    • forgetting the one that plays;
    • an old accounts.json reading back unchanged.
  • CLI, scratch homes:
    • account offline Steve_B, account offline Alex, then account select steve_b → "The game plays as Steve_B (offline)".
    • account marked * Steve_B.
    • play --instance hardcore gave the game --name Steve_B.
  • Window:
    • The chip showed Steve_B / Offline.
    • The menu listed Steve_B, Alex and Player, with the dot on Steve_B.
    • Picking Alex wrote "offline_selected": "Alex", and the chip turned to Alex.
    • Settings showed both names, Alex with "plays".
  • Not checked: adding a name from the Settings field in the window. The window lost key focus to another app during the run, so the typing didn't reach it. The same play_as path ran from the menu and the CLI.
Quick switch After picking Alex Settings > Account

🤖 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/2631 **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-accounts` --- ### 📝 Commits (1) - [`f1f34ed`](https://github.com/horizon-rust/horizon/commit/f1f34edb807607202f74c7af1aa705927fb6dcc8) launcher: offline names and a quick switch of who plays ### 📊 Changes **9 files changed** (+469 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+15 -3) 📝 `launcher/README.md` (+7 -0) 📝 `launcher/src/account.rs` (+95 -0) 📝 `launcher/src/account/tests.rs` (+40 -0) 📝 `launcher/src/cli.rs` (+52 -12) 📝 `launcher/src/game_log.rs` (+5 -7) 📝 `launcher/src/main.rs` (+19 -9) 📝 `launcher/src/servers_page.rs` (+5 -1) ➕ `launcher/src/switch_page.rs` (+231 -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. Launcher features, item 17: several accounts and a quick switch. Stacked on #2627 (Linux switches). Several Microsoft accounts already worked (sign in again for another, then "Play as"). Microsoft sign-in itself is still "coming soon" in releases (it needs the Azure and Mojang approval). Until then, what players can actually switch between is offline names, so this adds those and one place to switch. - **Quick switch**: the top bar's account chip used to jump to Settings. Now it opens a menu of everyone who can play: - each signed-in Microsoft account; - the offline names the player keeps; - the name the game made up (`horizon-player.txt`); - a dot on the one that plays, and **Manage accounts** at the bottom. - Picking one plays as it from the next Play. The chip shows the name and "Microsoft account" or "Offline". - **Settings > Account**: a row per offline name with **Play as** and **Forget**, then a field to add one. - An offline name is 3 to 16 letters, digits or `_`, like an account name. - Names are kept once, whatever the case. - `accounts.json` gains `offline` (the names) and `offline_selected`. An older file reads as before and is written back unchanged until a name is added. - The game gets `--name <offline name>` from the window's Play and from `play`, only when no Microsoft account is selected. A Microsoft account always plays with its own name. - Share log (#2622) also strips the offline names. - CLI and MCP: - `account offline [NAME]`: plays offline as NAME (kept), or as the game's name without one. - `account select <name>`: finds accounts and offline names. - `account forget-offline <name>`. - `account` lists both. The JSON has an `offline` array. - launcher/README.md: an Accounts bullet. ## Proof - fmt, clippy `-D warnings` and the launcher tests: clean and passing (181 + 36). The new test covers: - switching between an account, offline names and the game's name; - `--name` only when offline; - once-per-name in any case; - invalid names; - forgetting the one that plays; - an old `accounts.json` reading back unchanged. - CLI, scratch homes: - `account offline Steve_B`, `account offline Alex`, then `account select steve_b` → "The game plays as Steve_B (offline)". - `account` marked `* Steve_B`. - `play --instance hardcore` gave the game `--name Steve_B`. - Window: - The chip showed Steve_B / Offline. - The menu listed Steve_B, Alex and Player, with the dot on Steve_B. - Picking Alex wrote `"offline_selected": "Alex"`, and the chip turned to Alex. - Settings showed both names, Alex with "plays". - Not checked: adding a name from the Settings field in the window. The window lost key focus to another app during the run, so the typing didn't reach it. The same `play_as` path ran from the menu and the CLI. | Quick switch | After picking Alex | Settings > Account | |---|---|---| | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/accounts/menu.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/accounts/switched.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/accounts/settings.png) | 🤖 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:31 +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#4487
No description provided.