Skip to content

The Apple menu and app menus stop opening while a background agent is in front #443

Closed

Description

@M4n0x

What happens

The Apple menu and App menus stop opening. Their titles stay on the bar (Finder's here), but clicking them opens nothing. Clicking the desktop a few times brings them back, until it happens again a few seconds later.

Steps to reproduce

  1. Install Logitech G HUB. It starts lghub_system_tray in every account from /Library/LaunchAgents/com.logi.ghub.plist, and the tray keeps reopening its background agent, com.logi.ghub.agent, through LaunchServices, which brings the agent to the front.
  2. Show the Apple menu (click: menu) and App menus on the bar, with Finder in front.
  3. When the agent comes to the front, click the Apple logo or a menu title.

Without G HUB: run a small app with activation policy accessory that calls NSApp.activate(ignoringOtherApps: true). Any LSUIElement app that activates itself should do the same, such as a launcher.

Seen in a second, standard account, where the agent came to the front 44 times in 30 minutes; in the main account it did so twice.

Expected

The menus follow the app whose menus macOS shows. An agent that comes to the front has no menu bar, so macOS keeps the previous app's menus, and StableBar's should keep opening them.

Environment

  • StableBar 0.11.0 (main at dc5a611 with diagnostic logging)
  • macOS 27.2 (26B123)
  • Logitech G HUB, installed for all accounts
  • Standard test account, no window manager

Evidence

Diagnostic log in the test account while the agent was in front:

read com.logi.ghub.agent: failed items
openAppMenu Finder from app-menu
popup: item pid 34622 != app pid 35130
openAppMenu: no popup

Over one hour: 210 failed reads for com.logi.ghub.agent, 5 for com.apple.loginwindow, and 78 clicks that opened nothing. The system log shows launchservicesd SETFRONT: pid=35130 … oldFrontPid=34622 right after lghub_system_tray … LaunchServices.launchViaCSUA.

A probe app with activation policy accessory that activates itself: didActivateApplicationNotification fires and NSWorkspace.frontmostApplication is the probe, while NSWorkspace.menuBarOwningApplication stays on the previous app.

Diagnosis

On main at dc5a611:

  • Sources/StableBar/BarStore.swift:161-179: updateActiveApp runs on every didActivateApplicationNotification and reads the menus of NSWorkspace.shared.frontmostApplication, whatever its activation policy.
  • Sources/StableBar/AppMenu.swift:59-103: read(_:) stores that app. When its menu bar can't be read, the widgets keep the previous app's titles and retry (App menus and Apple menu intermittently disappear #120).
  • Sources/StableBar/AppMenu.swift:109-114: popup(for:) opens a title only when its pid matches the stored app, so every kept title is refused while the agent is in front.

Proposed fix: read the menus of NSWorkspace.shared.menuBarOwningApplication, which is key-value observable, and read again when it changes, instead of following the frontmost app.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 7, 2026
  2. stablebar-releases commented on Nov 10, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.12.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions