[PR #5334] [MERGED] Turn the narrator on: its options, toggle toast and Ctrl+B #6216

Closed
opened 2026-11-03 06:15:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: narrator/02-option-hotkey


📝 Commits (6)

  • 2fd9fe6 Add the narrator crate: GameNarrator, SAPI speech and screen narration state
  • e4fdd84 Open the narrator with the client and keep it in step with the options
  • b7a765b Make the narrator and narrator hotkey options work on the options screens
  • 004df57 Show the narrator's toggle toast wherever the player is
  • 8c59334 Cycle the narrator with Ctrl+B (Cmd+B on macOS) as KeyboardHandler does
  • 6515cc0 Merge main into #5334 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397)

📊 Changes

22 files changed (+1618 additions, -16 deletions)

View changed files

📝 Cargo.lock (+10 -0)
📝 Cargo.toml (+1 -0)
📝 crates/horizon-client-render/Cargo.toml (+2 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+97 -6)
📝 crates/horizon-client-render/src/settings.rs (+29 -0)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/game.rs (+18 -0)
📝 crates/horizon-client/src/game/advancements.rs (+3 -1)
📝 crates/horizon-client/src/game/clipboard.rs (+12 -7)
📝 crates/horizon-client/src/game/dialogs.rs (+12 -0)
➕ crates/horizon-client/src/game/narrator.rs (+244 -0)
📝 crates/horizon-client/src/game/options.rs (+10 -2)
📝 crates/horizon-client/src/game/startup_menu.rs (+60 -0)
📝 crates/horizon-client/src/title.rs (+4 -0)
➕ crates/horizon-narrator/Cargo.toml (+17 -0)
➕ crates/horizon-narrator/examples/say.rs (+28 -0)
➕ crates/horizon-narrator/src/lib.rs (+421 -0)
➕ crates/horizon-narrator/src/screen.rs (+417 -0)
➕ crates/horizon-narrator/src/speech.rs (+120 -0)
➕ crates/horizon-narrator/src/speech/linux.rs (+14 -0)

...and 2 more files

📄 Description

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

Part 2 of 16 of the narrator series. All 16 PRs have to be merged, in this order, for the narrator to work completely: #5333 → #5334 → #5335 → #5336 → #5337 → #5338 → #5339 → #5340 → #5341 → #5342 → #5343 → #5344 → #5346 → #5347 → #5348 → #5349. Each PR builds on the one before it (stacked branches), so until the previous one is merged this PR's diff also shows its commits; merging only some of them, or out of order, leaves the narrator unfinished.

Stacked on #5333 — merge that first; until then this PR also shows its commits.

Players can now turn the narrator on. Options → Accessibility Settings → Narrator (and Chat Settings) cycles Off / Narrates All / Narrates Chat / Narrates System, says "Narrator : ", and shows the "Narrator Enabled/Disabled" toast. Ctrl+B (Cmd+B on macOS) cycles it anywhere while Narrator Hotkey is on. On Windows the narrator speaks; on macOS and Linux it reads "Not Available" until PR 04.

What vanilla does

  • Minecraft's constructor makes the GameNarrator and runs checkStatus; Minecraft.destroy destroys it. The volume is Options.getFinalSoundSourceVolume(SoundSource.VOICE) (master × voice).
  • Options.narrator: its caption reads "Not Available" and OptionsSubScreen.addContents makes the button inactive while narrator.isActive() is false; a change runs GameNarrator.updateNarratorStatus. ChatOptionsScreen lists it too; narratorHotkey is a plain toggle (with options.accessibility.narrator_hotkey.mac.tooltip on macOS).
  • updateNarratorStatus shows the SystemToast NARRATOR_TOGGLE through SystemToast.addOrUpdate (a toast still up takes the new text and restarts its time).
  • KeyboardHandler.keyPress: B with hasControlDownWithQuirk (InputQuirks.REPLACE_CTRL_KEY_WITH_CMD_KEY) cycles the status when the narrator is active, the hotkey option is on and no focused EditBox takes the key.

What changed

  • crates/horizon-client/src/game/narrator.rs (new): start/stop, keeping the narrator in step with the options, the toast, Ctrl+B.
  • crates/horizon-client/src/game.rs, game/startup_menu.rs, game/options.rs, title.rs: start, stop, the options' changes, the toast over every screen (title, options, loading, in game; F1 hides it) and the startup menu's own toast until it hands the title over.
  • crates/horizon-client-render/src/options_ui.rs, settings.rs: the Narrator button's caption, inactive state and cycling; Narrator Hotkey with its macOS tooltip.
  • game/advancements.rs: the narrator toast takes a free ToastManager slot beside the advancement, tutorial and pack toasts.
  • game/clipboard.rs, game/dialogs.rs: which focused text boxes keep Ctrl+B.

How it was tested

  • cargo test -p horizon-client --bins narrator (the toast updated in place), cargo test -p horizon-client-render --lib options_ui (the option's four statuses and announcement, inactive and "Not Available" without speech, Chat Settings).
  • clippy (all targets) clean at this tip; fmt.
  • To try: HORIZON_NO_AUDIO=1, then horizon-ctl options-set narrator 1 and horizon-ctl narration show the announcement.

Known differences from vanilla

  • No message box when text-to-speech is missing (logged instead).
  • The first launch's accessibility onboarding (already on main) keeps its Narrator button inactive; Ctrl+B and the Accessibility Settings work there. Follow-up.

🤖 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/5334 **Author:** [@leifiyoo](https://github.com/leifiyoo) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `narrator/02-option-hotkey` --- ### 📝 Commits (6) - [`2fd9fe6`](https://github.com/horizon-rust/horizon/commit/2fd9fe63b4d576f1778c89f2a886edbb9c0772fa) Add the narrator crate: GameNarrator, SAPI speech and screen narration state - [`e4fdd84`](https://github.com/horizon-rust/horizon/commit/e4fdd84c66944fa1bd5f190c54be79b4bf4f7066) Open the narrator with the client and keep it in step with the options - [`b7a765b`](https://github.com/horizon-rust/horizon/commit/b7a765b39c2bb417abb0ecbe02dc21eb9f9dcf40) Make the narrator and narrator hotkey options work on the options screens - [`004df57`](https://github.com/horizon-rust/horizon/commit/004df578ef714e01fb042a62aba8cd25b7857554) Show the narrator's toggle toast wherever the player is - [`8c59334`](https://github.com/horizon-rust/horizon/commit/8c5933402f4e84788e3c1444140aaed351538986) Cycle the narrator with Ctrl+B (Cmd+B on macOS) as KeyboardHandler does - [`6515cc0`](https://github.com/horizon-rust/horizon/commit/6515cc060587279e987c88e5bdd5128593006fd2) Merge main into #5334 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397) ### 📊 Changes **22 files changed** (+1618 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+10 -0) 📝 `Cargo.toml` (+1 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+2 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+97 -6) 📝 `crates/horizon-client-render/src/settings.rs` (+29 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+18 -0) 📝 `crates/horizon-client/src/game/advancements.rs` (+3 -1) 📝 `crates/horizon-client/src/game/clipboard.rs` (+12 -7) 📝 `crates/horizon-client/src/game/dialogs.rs` (+12 -0) ➕ `crates/horizon-client/src/game/narrator.rs` (+244 -0) 📝 `crates/horizon-client/src/game/options.rs` (+10 -2) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+60 -0) 📝 `crates/horizon-client/src/title.rs` (+4 -0) ➕ `crates/horizon-narrator/Cargo.toml` (+17 -0) ➕ `crates/horizon-narrator/examples/say.rs` (+28 -0) ➕ `crates/horizon-narrator/src/lib.rs` (+421 -0) ➕ `crates/horizon-narrator/src/screen.rs` (+417 -0) ➕ `crates/horizon-narrator/src/speech.rs` (+120 -0) ➕ `crates/horizon-narrator/src/speech/linux.rs` (+14 -0) _...and 2 more files_ </details> ### 📄 Description > 🤖 Opened by leifiyoo's AI agent (Claude), not by leifiyoo. **Part 2 of 16 of the narrator series.** All 16 PRs have to be merged, in this order, for the narrator to work completely: #5333 → #5334 → #5335 → #5336 → #5337 → #5338 → #5339 → #5340 → #5341 → #5342 → #5343 → #5344 → #5346 → #5347 → #5348 → #5349. Each PR builds on the one before it (stacked branches), so until the previous one is merged this PR's diff also shows its commits; merging only some of them, or out of order, leaves the narrator unfinished. Stacked on #5333 — merge that first; until then this PR also shows its commits. Players can now turn the narrator on. **Options → Accessibility Settings → Narrator** (and Chat Settings) cycles Off / Narrates All / Narrates Chat / Narrates System, says "Narrator : <status>", and shows the "Narrator Enabled/Disabled" toast. **Ctrl+B** (Cmd+B on macOS) cycles it anywhere while **Narrator Hotkey** is on. On Windows the narrator speaks; on macOS and Linux it reads "Not Available" until PR 04. ## What vanilla does - `Minecraft`'s constructor makes the `GameNarrator` and runs `checkStatus`; `Minecraft.destroy` destroys it. The volume is `Options.getFinalSoundSourceVolume(SoundSource.VOICE)` (master × voice). - `Options.narrator`: its caption reads "Not Available" and `OptionsSubScreen.addContents` makes the button inactive while `narrator.isActive()` is false; a change runs `GameNarrator.updateNarratorStatus`. `ChatOptionsScreen` lists it too; `narratorHotkey` is a plain toggle (with `options.accessibility.narrator_hotkey.mac.tooltip` on macOS). - `updateNarratorStatus` shows the `SystemToast` `NARRATOR_TOGGLE` through `SystemToast.addOrUpdate` (a toast still up takes the new text and restarts its time). - `KeyboardHandler.keyPress`: B with `hasControlDownWithQuirk` (`InputQuirks.REPLACE_CTRL_KEY_WITH_CMD_KEY`) cycles the status when the narrator is active, the hotkey option is on and no focused `EditBox` takes the key. ## What changed - `crates/horizon-client/src/game/narrator.rs` (new): start/stop, keeping the narrator in step with the options, the toast, Ctrl+B. - `crates/horizon-client/src/game.rs`, `game/startup_menu.rs`, `game/options.rs`, `title.rs`: start, stop, the options' changes, the toast over every screen (title, options, loading, in game; F1 hides it) and the startup menu's own toast until it hands the title over. - `crates/horizon-client-render/src/options_ui.rs`, `settings.rs`: the Narrator button's caption, inactive state and cycling; Narrator Hotkey with its macOS tooltip. - `game/advancements.rs`: the narrator toast takes a free ToastManager slot beside the advancement, tutorial and pack toasts. - `game/clipboard.rs`, `game/dialogs.rs`: which focused text boxes keep Ctrl+B. ## How it was tested - `cargo test -p horizon-client --bins narrator` (the toast updated in place), `cargo test -p horizon-client-render --lib options_ui` (the option's four statuses and announcement, inactive and "Not Available" without speech, Chat Settings). - clippy (all targets) clean at this tip; fmt. - To try: `HORIZON_NO_AUDIO=1`, then `horizon-ctl options-set narrator 1` and `horizon-ctl narration` show the announcement. ## Known differences from vanilla - No message box when text-to-speech is missing (logged instead). - The first launch's accessibility onboarding (already on main) keeps its Narrator button inactive; Ctrl+B and the Accessibility Settings work there. Follow-up. 🤖 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 06:15:58 +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#6216
No description provided.