feat: add onMenuOpened callback to Tray composable#385
Merged
kdroidFilter merged 4 commits intomasterfrom Apr 13, 2026
Merged
Conversation
Add a callback invoked when the tray menu is about to be shown, allowing apps to refresh state on demand. Implemented via the DBusMenu AboutToShow protocol on Linux; noop on Windows/macOS. Includes LayoutUpdated-based suppression to prevent feedback loops when the callback mutates menu state, and build script cache invalidation to avoid stale native library issues.
- Add menu opened callback storage and dispatch in TrayContext (Swift) - Invoke callback in InstanceButtonClickHandler.handleClick() before menu.popUp() - Expose tray_set_menu_opened_callback() C API with per-instance support - Add JNI bridge and trampoline for menu opened callback - Wire callback through MacNativeBridge, MacTrayManager, and MacTrayInitializer - Initialize callback after tray_init() to ensure TrayContext exists - Clear native library cache in macOS build script (darwin-aarch64/x86-64) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Introduced `onMenuOpened` support in `WindowsTrayManager` for detecting menu opening events - Integrated JNI binding for `tray_set_menu_opened_callback` in native Windows implementation - Updated initialization and update methods to include the menu-opened callback - Enhanced tray behavior with improved event handling and callback support
… initializer calls - Reformatted method calls in NativeTray for better readability and consistency - Updated Linux, Windows, and macOS initializer and updater invocations with multiline argument structure
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.
Summary
Closes #233
onMenuOpened: (() -> Unit)? = nullparameter to allTray()composable overloadsAboutToShowprotocol to detect when the menu is about to open~/.cache/composetray/native library cache to avoid stale .so issuesAPI usage
Test plan