Skip to content

fix: resolve menu bar item source apps on macOS Tahoe (26.x)#789

Open
roelvangils wants to merge 2 commits intoFelixKratz:masterfrom
roelvangils:tahoe-fix-source-pid
Open

fix: resolve menu bar item source apps on macOS Tahoe (26.x)#789
roelvangils wants to merge 2 commits intoFelixKratz:masterfrom
roelvangils:tahoe-fix-source-pid

Conversation

@roelvangils
Copy link
Copy Markdown

Summary

  • Fixes the alias feature on macOS 26 (Tahoe) where menu bar items are now owned by "Control Centre" instead of their source applications
  • Uses the Accessibility API (AXUIElementRef with kAXExtrasMenuBarAttribute) to resolve the real source app by matching window bounds to accessibility element frames
  • Preserves existing behavior on macOS < 26

Problem

On macOS 26, Apple changed how third-party menu bar items work. Instead of items being owned by their source applications (e.g., Little Snitch Agent,Item-0), they are now all owned by Control Centre (e.g., Control Centre,Item-0). This breaks SketchyBar's alias feature since it relies on the owner name to match items.

Solution

This PR adds a new source_pid module that:

  1. Uses the Accessibility API to enumerate running applications
  2. For each app, checks for the kAXExtrasMenuBarAttribute (extras menu bar / status items)
  3. Matches window bounds to accessibility element frames to identify the real source app
  4. Returns the resolved app name for use in alias lookups

The approach is similar to how Ice menu bar manager solved this in their macos-26 branch.

Test plan

  • Tested on macOS 26.2 (Tahoe)
  • Verified --query default_menu_items returns correct app names instead of "Control Centre"
  • Verified aliases can be created using real app names (e.g., Little Snitch Agent,Item-0)
  • Should be tested on macOS 15.x to ensure backwards compatibility

Files changed

  • src/source_pid.h - Header for new source PID module
  • src/source_pid.m - Implementation using Accessibility API
  • src/alias.c - Integrated source PID lookup in print_all_menu_items() and alias_find_window()
  • makefile - Added source_pid.om to build

🤖 Generated with Claude Code

roelvangils and others added 2 commits December 12, 2025 00:07
On macOS 26 (Tahoe), Apple changed the ownership of third-party menu bar
items. These items are now owned by "Control Centre" instead of their
source applications. This breaks the alias feature as SketchyBar can no
longer identify which app owns which menu bar item.

This fix uses the Accessibility API to resolve the real source application
for each menu bar item:

- Adds source_pid.h/m: New module that uses AXUIElementRef and the
  kAXExtrasMenuBarAttribute to find the real source app by matching
  window bounds to accessibility element frames
- Updates alias.c: Integrates the source PID lookup in both
  print_all_menu_items() and alias_find_window() functions
- On macOS < 26, the existing behavior is preserved

The approach is similar to how Ice menu bar manager solved this issue
in their macos-26 branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Reformatted --query default_menu_items output to show a clean table with
  app names and ready-to-use alias commands
- Added 5-second throttle to source_pid_cache_refresh() to prevent
  performance issues when multiple aliases update simultaneously
- Moved throttle check inside mutex lock to prevent race conditions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@junyudev
Copy link
Copy Markdown

junyudev commented Jan 26, 2026

Tested on my macOS 26.0 Beta (25A5346a):

  • Yes, aliases can be created using real app names (e.g., ⁠Little Snitch Agent,Item-0).
  • However, ⁠--query default_menu_items returns nothing (when Accessibility is enabled).

If Accessibility is off, the query shows a bunch of ⁠Control Center items, similar to: #788 .
(my system uses “Center” instead of “Centre,” likely because my macOS version is a bit older.)
Also, SketchyBar in this PR does not seem to request Accessibility permissions on launch.

@volker-fr
Copy link
Copy Markdown

@FelixKratz, just checking in on this. Are there any concerns or blockers holding this PR up?

The underlying issue impacts the Sketchybar experience quite a bit, so I'd love to get this resolved. Let me know if there's anything we can do to help address any hesitations you might have!

@FelixKratz
Copy link
Copy Markdown
Owner

I had a go at fixing this issue myself here: 262fa35. For context, the issue I had with this approach here is that it involves a lot of additional book-keeping and additional permission requirements (accessibility). The owner of the menu bar items moving to Control Center was actually never the core problem of the design. The design was never meant to handle duplicate owner-name combinations. Those started to appear frequently with the owner moving to Control Center. The solution is to simply add an additional index to --query default_menu_items, which is also respected by the --add alias ... syntax.

Please test with latest master if problems are resolved.

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.

4 participants