fix(systray): recover click type on macOS 27 - #5919
Open
ChewbaccaCookie wants to merge 1 commit into
Open
Conversation
On macOS 27 Golden Gate, [NSApp currentEvent] inside an NSStatusItem action selector no longer reflects the originating mouse-down, so processClick's left/right switch dropped the event. Coerce via [NSEvent pressedMouseButtons] as a fallback. Behaviour on macOS <=26 is unchanged (the coercion is a no-op when the raw event type is already a mouse-down). Adds a table-driven regression test. Closes wailsapp#5752
Contributor
WalkthroughThe Darwin status item callback now coerces macOS event types using the pressed-button state before dispatch. A Go wrapper exposes the C helper for testing. Darwin regression tests cover legacy and macOS 27 event types. ChangesDarwin status item event handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ChewbaccaCookie
force-pushed
the
fix/5752-macos27-tray-click-event-coercion
branch
from
August 6, 2026 15:17
3563e45 to
cbe84c2
Compare
27 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Context
macOS 27 Golden Gate (currently in developer beta) rebuilds the menu bar and NSStatusItem
internals substantially. Apple has publicly acknowledged the direction of travel on developer forums thread 832823
(https://developer.apple.com/forums/thread/832823): "Local event monitors are no longer the
recommended way of scanning for events on status items." The wider menu-bar-app ecosystem
(Ice, BetterDisplay, Deskflow, SaneBar, …) is hitting parallel issues. This PR is a tactical
fix for one specific symptom in Wails
Info: a broader review of the local-event-monitor pattern in systemtray_darwin.m is a reasonable follow-up. This is partially already started in #5760.
Problem
On macOS 27 Golden Gate, left-clicking a Wails system tray icon does nothing (#5752).
Right-click still works.
The root cause is a behaviour change in AppKit's event dispatch:
button's sendActionOn: handler.
NSEventTypeLeftMouseDown / NSEventTypeRightMouseDown.
Fix
Introduce a small C helper, systemTrayCoerceEventType, that maps the raw event type to a
button processClick can dispatch on:
path), pass it through unchanged.
(left), matching existing right-click-takes-precedence semantics.
click, so something triggered it.
statusItemClicked: sends the coerced value to Go instead of raw event.type. The Go switch is
untouched, so macOS ≤26 behaviour is unchanged.
Fixes #5752.
Type of change
Please select the option that is relevant.
How Has This Been Tested?
Was tested on macOS 27.0 beta(26A5388g) and on macOS 26.5.2 (25F84).
Test Configuration
Wails v3.0.0-beta.4 › Wails Doctor # System ┌────────────────────────────┐ | Name | MacOS | | Version | 27.0 | | ID | 26A5388g | | Branding | MacOS 27.0 | | Platform | darwin | | Architecture | arm64 | | Apple Silicon | true | | CPU | Apple M3 | | CPU | Apple M3 | | GPU | 10 cores | | Memory | 16 GB | └────────────────────────────┘ # Build Environment ┌──────────────────────────────────────────────────────────────────────┐ | Wails CLI | v3.0.0-beta.4 | | Go Version | go1.26.5 | | -buildmode | exe | | -compiler | gc | | CGO_CFLAGS | | | CGO_CPPFLAGS | | | CGO_CXXFLAGS | | | CGO_ENABLED | 1 | | CGO_LDFLAGS | | | DefaultGODEBUG | cryptocustomrand=1,tlssecpmlkem=0,urlstrictcolons=0 | | GOARCH | arm64 | | GOARM64 | v8.0 | | GOOS | darwin | └──────────────────────────────────────────────────────────────────────┘ # Dependencies ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | *Android SDK | Not found. Set ANDROID_HOME (install via Android Studio or the command-line tools). | | *NSIS | Not Installed. Install with `brew install makensis`. | | *Xcode (iOS) | Not installed. iOS builds need full Xcode (App Store), not just the CLI tools. | | *iOS Device SDK | Not found | | *iOS Simulator SDK | Not found | | Xcode cli tools | 2417 | | npm | 10.9.8 | | docker | *Not installed (optional - for cross-compilation) | | | └──────────────────────────────────────── * - Optional Dependency ─────────────────────────────────────────┘ # Signing ┌────────────────────────────────────────┐ | macOS Signing | Not configured | | Windows Signing | Not configured | | Linux Signing | Not configured (GPG) | └────────────────────────────────────────┘ # Checking for issues SUCCESS No issues found # Diagnosis SUCCESS Your system is ready for Wails development!Checklist:
website/src/pages/changelog.mdxwith details of this PR (v3 changelog entries are added automatically)Summary by CodeRabbit