fix(gui): refresh the macOS device menu when inventory changes#456
fix(gui): refresh the macOS device menu when inventory changes#456Phecda wants to merge 1 commit into
Conversation
Greptile SummaryThis PR keeps the native macOS Device menu synchronized with the live device inventory by calling
Confidence Score: 5/5Safe to merge — the two-line change is narrowly scoped, the menu rebuild is guarded behind the existing Both changes are small and well-contained. The No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent as openlogi-agent
participant IPC as IPC Client
participant SelectLoop as select loop
participant State as AppState
participant GPUI as GPUI runtime
participant Menu as macOS menu bar
Agent->>IPC: Snapshot (inventory + status)
IPC->>SelectLoop: GuiUpdate::Snapshot
SelectLoop->>State: refresh_inventories() + set_agent_link()
State-->>SelectLoop: "changed = merged | link_changed"
alt "changed == true"
SelectLoop->>GPUI: cx.refresh_windows()
SelectLoop->>Menu: app_menu::rebuild(cx)
Menu->>State: read device_list
State-->>Menu: Vec of DeviceRecord
Menu-->>Menu: set_menus() with updated Device submenu
else "changed == false"
SelectLoop-->>SelectLoop: skip no-op
end
Reviews (1): Last reviewed commit: "fix(gui): keep macos device menu current" | Re-trigger Greptile |
| if changed { | ||
| cx.refresh_windows(); | ||
| app_menu::rebuild(cx); | ||
| } |
There was a problem hiding this comment.
Menu rebuilt on agent-link-only changes
changed is the bitwise OR of merged (inventory change) and state.set_agent_link(...) (agent-link change). When only the agent link transitions (e.g. Ready → Ready with a new status but identical inventory), app_menu::rebuild fires even though the Device submenu content is identical. This is harmless — set_menus is cheap — but for clarity it could be worth gating the menu rebuild specifically on merged, similar to how the set_agent_link standalone helper only calls cx.refresh_windows() when the link itself changes. Not a bug, just a minor unnecessary call on non-inventory transitions.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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.NoActionfor informational disabled menu entries instead of routing them through Settings actions.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceNo devices connected.Fixes #455