Skip to content

fix(gui): refresh the macOS device menu when inventory changes - #456

Open
Phecda wants to merge 2 commits into
AprilNEA:masterfrom
Phecda:fix/macos-device-menu-refresh
Open

fix(gui): refresh the macOS device menu when inventory changes#456
Phecda wants to merge 2 commits into
AprilNEA:masterfrom
Phecda:fix/macos-device-menu-refresh

Conversation

@Phecda

@Phecda Phecda commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Keep the native macOS Device menu synchronized with the device records shown by the GUI.

Changes

  • openlogi-gui: rebuild the application menu when an agent update changes the displayed state, without rebuilding it for unchanged polling snapshots.
  • Use NoAction for informational disabled menu entries instead of routing them through Settings actions.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • Hardware-tested on macOS 26.5.2 with an MX Master 3 over Unifying; after inventory loading, the native Device menu listed the active device records instead of remaining on No devices connected.

Fixes #455

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the macOS Device menu staying frozen on "No devices connected" after inventory loads, by calling app_menu::rebuild whenever the inventory merge returns a real change (merged). It also replaces the semantically misleading OpenSettings action on disabled informational items with gpui::NoAction.

  • main.rs: Promotes merged out of the update_global closure so the menu rebuild can be gated on actual inventory changes independently of agent-link status transitions — avoiding unnecessary rebuilds on pure link-state polls.
  • app_menu.rs: Device name and "No devices connected" entries now carry gpui::NoAction instead of OpenSettings, correctly expressing that these items are display-only labels with no dispatch target.

Confidence Score: 5/5

Safe to merge — the change is a focused, well-reasoned bug fix with no regressions introduced.

Both changes are minimal and correct. The merged flag is already computed inside update_global and simply needed to be surfaced; the rebuild is gated precisely on inventory changes, matching the condition that actually mutates the Device submenu content. The NoAction substitution removes a misleading action reference from items that are always disabled. Hardware testing confirms the fix works end-to-end.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
crates/openlogi-gui/src/app_menu.rs Replaces OpenSettings with gpui::NoAction for disabled informational Device menu entries; semantically correct change with no functional impact since items are always .disabled(true).
crates/openlogi-gui/src/main.rs Adds merged to the update_global return tuple and calls app_menu::rebuild only when inventory actually changed, correctly fixing the stale Device menu bug without over-triggering on agent-link-only status updates.

Sequence Diagram

sequenceDiagram
    participant Agent
    participant MainLoop as Main Loop (Tokio)
    participant AppState
    participant GPUI as GPUI (cx)
    participant Menu as macOS Menu Bar

    Agent->>MainLoop: GuiUpdate::Snapshot(update)
    MainLoop->>AppState: refresh_inventories() → merged
    MainLoop->>AppState: set_agent_link() → link_changed
    Note over AppState: changed = merged | link_changed
    AppState-->>MainLoop: (changed, merged, ...)
    alt "changed == true"
        MainLoop->>GPUI: cx.refresh_windows()
    end
    alt "merged == true"
        MainLoop->>GPUI: app_menu::rebuild(cx)
        GPUI->>Menu: cx.set_menus(menus(cx))
        Note over Menu: Device submenu now lists current device records
    end
Loading

Reviews (2): Last reviewed commit: "fix(gui): rebuild device menu only for i..." | Re-trigger Greptile

Comment thread crates/openlogi-gui/src/main.rs
@AprilNEA
AprilNEA self-requested a review July 31, 2026 22:18
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.

[Bug]: macOS Device menu does not refresh after devices load

2 participants