fix(tray): show "Stop HD recording" when an HD session is active#3959
Merged
Conversation
The tray menu's change-detection struct MenuState omitted HD/high-fps state, so starting or stopping an HD session never changed MenuState. update_menu_if_needed then computed should_update=false and never re-queued the tray menu. On macOS apply_pending_tray_menu had nothing to install, so the menu kept showing the "Record HD" submenu instead of "Stop HD recording (... left)", even though the engine reported the session active (verified live: GET /capture/hd returns active:true while the tray still showed Record HD). create_dynamic_menu already reads get_high_fps_status() live, so the only gap was the rebuild trigger. Add hd_active / hd_remaining_secs / hd_session_kind / hd_interval_ms to MenuState and populate them from get_high_fps_status() so any visible HD label change re-queues the menu. The countdown ticks now too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an HD session is active, the tray menu kept showing the "Record HD" duration submenu instead of "Stop HD recording (… left)", so there was no way to see HD was running or stop it early. Reported on v2.5.27 (macOS).
Root cause
The macOS tray avoids background
set_menu(muda use-after-free), so the poller queues "pending" menu inputs and the mouse-down handler installs them on open. A pending refresh is only queued whenshould_updatefires, andshould_updateis driven entirely by theMenuStatechange-detection struct.MenuStatetracked shortcuts, recording status, devices, subscription, etc. but no HD/high-fps state. So toggling HD changed nothing inMenuState:sequenceDiagram participant U as User participant Eng as Engine (/capture/hd) participant Poll as update_menu_if_needed (~1s) participant MS as MenuState (change-detect) participant Tray as tray menu (on open) U->>Eng: Record HD -> 15 min Eng-->>Eng: active=true (verified live) Poll->>MS: build new_state (no HD field) MS-->>Poll: new_state == last_state Note over Poll: should_update = false -> NO pending queued U->>Tray: click tray Note over Tray: pending is None -> keep stale menu Tray-->>U: still shows "Record HD" ❌Confirmed live while the bug reproduced:
GET /capture/hdreturned{"active":true,"session":{"kind":"timer"},"remainingSecs":453}while the tray still showed "Record HD".create_dynamic_menualready readsget_high_fps_status()live, so the only gap was the rebuild trigger.Fix
Add the HD fields to
MenuStateand populate them fromget_high_fps_status(), so any visible HD label change (start, stop, countdown, fps, meeting-vs-timer) re-queues the menu:The 3
MenuState::default()sites are unaffected (new fields default to false/0/""). Net: starting HD now flips the menu to "Stop HD recording (… left)" on the next open, the countdown ticks, and stopping returns it to the "Record HD" submenu.Test
Compilation verified by Rust CI + the Release App build on this PR (the tauri crate's
build.rsneeds sidecars, so it builds in CI rather than locally).🤖 Generated with Claude Code