[PR #1557] [MERGED] Launcher: Cmd+Q quits and Cmd+W closes the window on macOS #3585

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

📋 Pull Request Information

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

Base: main ← Head: fix/launcher-cmd-q


📝 Commits (1)

  • 87aa88d Launcher: Cmd+Q quits and Cmd+W closes the window on macOS

📊 Changes

1 file changed (+78 additions, -10 deletions)

View changed files

📝 launcher/src/main.rs (+78 -10)

📄 Description

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

What

Cmd+Q now quits the launcher on macOS, and Cmd+W closes its window. Reported on Discord: "Command + Q does not work on macos to close the launcher; for the game itself it works."

Why

The launcher registered no app menu and no key bindings, so macOS had nothing to run on Cmd+Q.

How

launcher/src/main.rs only:

  • Quit and CloseWindow actions; cmd-q and cmd-w are bound on macOS only (Linux and Windows are unchanged, and the launcher had no Ctrl+Q before).
  • An app menu with "Quit Horizon Launcher" and a Window menu with "Close Window".
  • Quit and closing the window share one shut_down path: stop the servers this launcher started (unless they run as a service), send telemetry, exit. The game is a separate process that the launcher never kills on exit, so a running game keeps running, the same as when the window is closed today. There is no prompt, and none is added.
  • Close Window removes the window from a deferred callback: an action fired by a key press runs inside a window update, where the window cannot be removed (my first version silently did nothing).

Tested

Isolated mktemp HORIZON_LAUNCHER_HOME / HORIZON_HOME / XDG_*, HORIZON_LAUNCHER_NO_SELF_UPDATE=1, debug build on the Mac mini. The Mac mini's screen session was locked, so System Events keystrokes never reached the app; I posted Cmd+Q and Cmd+W key events straight to the launcher's pid (CGEvent.postToPid) instead.

  • plain origin/main: Cmd+Q left the process running, Cmd+W too.
  • this branch: Cmd+Q exited the process, Cmd+W closed the window and exited (twice each).
  • The menu item "Quit Horizon Launcher" was clicked through System Events: the process exited. The menu bar shows Apple, horizon-launcher, Window.
  • Not run live: Cmd+Q with a game running. The code shows the launcher never kills the game on exit (Running has no Drop, shut_down only stops servers), and it is the same path as closing the window.
  • Unit tests: cmd_q_quits_and_cmd_w_closes_the_window (Keymap lookup, macOS only) and the_app_menu_has_quit.
cargo fmt --check                                  ok
cargo clippy --all-targets -D warnings (launcher)  clean
cargo test (launcher): lib 114 passed; bin 26 passed, 1 failed

The one failure, cli_tools::tests::the_launcher_reference_is_up_to_date (docs/launcher-commands.md out of date), fails the same way on plain origin/main; it is not touched by this PR.

Nothing needs Ludovic.

🤖 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/1557 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-cmd-q` --- ### 📝 Commits (1) - [`87aa88d`](https://github.com/horizon-rust/horizon/commit/87aa88de54b82bea3e05a04dd0104f3147224211) Launcher: Cmd+Q quits and Cmd+W closes the window on macOS ### 📊 Changes **1 file changed** (+78 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/main.rs` (+78 -10) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Cmd+Q now quits the launcher on macOS, and Cmd+W closes its window. Reported on Discord: "Command + Q does not work on macos to close the launcher; for the game itself it works." ## Why The launcher registered no app menu and no key bindings, so macOS had nothing to run on Cmd+Q. ## How `launcher/src/main.rs` only: - `Quit` and `CloseWindow` actions; `cmd-q` and `cmd-w` are bound on macOS only (Linux and Windows are unchanged, and the launcher had no Ctrl+Q before). - An app menu with "Quit Horizon Launcher" and a Window menu with "Close Window". - Quit and closing the window share one `shut_down` path: stop the servers this launcher started (unless they run as a service), send telemetry, exit. The game is a separate process that the launcher never kills on exit, so a running game keeps running, the same as when the window is closed today. There is no prompt, and none is added. - Close Window removes the window from a deferred callback: an action fired by a key press runs inside a window update, where the window cannot be removed (my first version silently did nothing). ## Tested Isolated `mktemp` HORIZON_LAUNCHER_HOME / HORIZON_HOME / XDG_*, `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`, debug build on the Mac mini. The Mac mini's screen session was locked, so System Events keystrokes never reached the app; I posted Cmd+Q and Cmd+W key events straight to the launcher's pid (`CGEvent.postToPid`) instead. - plain `origin/main`: Cmd+Q left the process running, Cmd+W too. - this branch: Cmd+Q exited the process, Cmd+W closed the window and exited (twice each). - The menu item "Quit Horizon Launcher" was clicked through System Events: the process exited. The menu bar shows `Apple, horizon-launcher, Window`. - Not run live: Cmd+Q with a game running. The code shows the launcher never kills the game on exit (`Running` has no `Drop`, `shut_down` only stops servers), and it is the same path as closing the window. - Unit tests: `cmd_q_quits_and_cmd_w_closes_the_window` (Keymap lookup, macOS only) and `the_app_menu_has_quit`. ``` cargo fmt --check ok cargo clippy --all-targets -D warnings (launcher) clean cargo test (launcher): lib 114 passed; bin 26 passed, 1 failed ``` The one failure, `cli_tools::tests::the_launcher_reference_is_up_to_date` (docs/launcher-commands.md out of date), fails the same way on plain `origin/main`; it is not touched by this PR. Nothing needs Ludovic. 🤖 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:10:37 +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#3585
No description provided.