Skip to content

fix(tray): show "Stop HD recording" when an HD session is active#3959

Merged
louis030195 merged 1 commit into
mainfrom
claude/fix-tray-hd-stop-menu
Jun 10, 2026
Merged

fix(tray): show "Stop HD recording" when an HD session is active#3959
louis030195 merged 1 commit into
mainfrom
claude/fix-tray-hd-stop-menu

Conversation

@louis030195

Copy link
Copy Markdown
Collaborator

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 when should_update fires, and should_update is driven entirely by the MenuState change-detection struct.

MenuState tracked shortcuts, recording status, devices, subscription, etc. but no HD/high-fps state. So toggling HD changed nothing in MenuState:

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" ❌
Loading

Confirmed live while the bug reproduced: GET /capture/hd returned {"active":true,"session":{"kind":"timer"},"remainingSecs":453} 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.

Fix

Add the HD fields to MenuState and populate them from get_high_fps_status(), so any visible HD label change (start, stop, countdown, fps, meeting-vs-timer) re-queues the menu:

hd_active / hd_remaining_secs / hd_session_kind / hd_interval_ms

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

  1. Tray > Record HD > 15 minutes.
  2. Reopen the tray menu: it now shows "Stop HD recording (~10 fps, 14m left)" plus "Extend HD by +30 min" (was: "Record HD" submenu).
  3. Click Stop HD: menu returns to the "Record HD" submenu.

Compilation verified by Rust CI + the Release App build on this PR (the tauri crate's build.rs needs sidecars, so it builds in CI rather than locally).

🤖 Generated with Claude Code

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>
@louis030195 louis030195 merged commit 4acdbc9 into main Jun 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant