Split TrayApp into a separate composenativetray-app module (#418)#419
Open
kdroidFilter wants to merge 3 commits into
Open
Split TrayApp into a separate composenativetray-app module (#418)#419kdroidFilter wants to merge 3 commits into
kdroidFilter wants to merge 3 commits into
Conversation
Move TrayApp and its state/dismiss-mode/animation helpers into a new :tray-app module, published as composenativetray-app, so apps that only need a basic tray icon no longer pull in the decorated-window-tao windowing backend. - Core (composenativetray) keeps the Tray/menu API and native tray impl unchanged, and drops its direct decorated-window-tao dependency. - TrayScreenGeometry is now windowing-agnostic (injectable scale/work-area providers with fallbacks); tray-app installs the Tao-backed geometry. - NativeTray and TrayScreenGeometry are now public (shared engine used by both modules); the public Tray / TrayApp API is unchanged. - Bump Nucleus to 2.0.5. - README: document the two artifacts and correct the snippets to the current nucleusApplication / SingleInstanceRestoreEffect API.
… screen fallback Addresses the code-review findings on the module split. - Move TrayScreenGeometry + all popup positioning (getTrayWindowPosition / getTrayWindowPositionForInstance, corner detection, persistence) into :tray-app, where the Tao backend is always present. The core artifact no longer fabricates a 1920x1080 screen when no windowing backend is available: the native tray managers just record the raw tray-icon click, and tray-app resolves the corner + window position against real Tao geometry. macOS native status-item queries are reached through typed MacTrayInitializer wrappers so the JNI bridge stays internal. - Move TrayApp/TrayAppState/TrayWindowDismissMode and friends to package dev.nucleusframework.composenativetray.trayapp so no package is split across the two published JARs (unblocks JPMS module-path consumers). - tray-app: declare nucleus.application as api (it is TrayApp's receiver type). - Align the tray-app log timestamp format with the core formatter. - README: document the trayapp package and that getTrayWindowPosition lives in composenativetray-app; getTrayPosition stays in core. Consequence: getTrayPosition() on Linux, when used without composenativetray-app, returns the desktop-environment default corner instead of a click-derived one.
getTrayPosition() and the TrayPosition enum now live in composenativetray-app (package ...trayapp), next to the popup positioning they feed, so the core artifact exposes no tray-corner / positioning API at all. The native tray-region queries are reached through typed wrappers (WindowsTrayInitializer.notificationIconsRegion, MacTrayInitializer.statusItemRegion) so the JNI bridges stay internal to core. Core's TrayPosition.kt is reduced to the raw click tracker (TrayClickTracker + TrayClickPoint) and renamed TrayClickTracker.kt. Demos and README updated for the new package. This also removes the Linux core-only degradation: getTrayPosition now always has Tao geometry available in tray-app.
amir1376
reviewed
Jul 14, 2026
| @@ -50,7 +50,7 @@ kotlin { | |||
| implementation(libs.nucleus.core.runtime) | |||
| implementation(libs.nucleus.darkmode.detector) | |||
| api(libs.nucleus.application) | |||
Contributor
There was a problem hiding this comment.
can it be replaced with the core-runtime instead?
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.
Fixes #418.
Splits the single
composenativetrayartifact so apps that only need a basic system tray icon no longer pull in thedecorated-window-taowindowing backend. Public API and behaviour are unchanged.What changed
:tray-appmodule (dev.nucleusframework:composenativetray-app) holdsTrayAppand itsTrayAppState/TrayWindowDismissMode/ animation helper. It owns thenucleus.decorated-window-taodependency.composenativetraykeeps theTray/ menu DSL and native tray implementation unchanged, and drops its directdecorated-window-taodependency (nucleus.applicationstays — it backs theNucleusApplicationScope.Trayreceiver).TrayScreenGeometryis now windowing-agnostic: it exposes injectable scale / work-area providers (with graceful fallbacks) instead of calling Tao directly.tray-appinstalls the Tao-backed providers at composition, so behaviour withTrayAppis identical.NativeTrayandTrayScreenGeometryare nowpublic(shared engine used by both modules). No change to theTray/TrayApppublic API.2.0.3→2.0.5.nucleusApplication/SingleInstanceRestoreEffectAPI.Consumer impact
composenativetraycoordinate, now lighter.TrayAppusers: add one dependency —implementation("dev.nucleusframework:composenativetray-app:<version>").Verification
composenativetray,:tray-appand:demoall compile; ktlint + detekt + core test pass../gradlew :dependenciesconfirmsdecorated-window-taois absent from the core runtime classpath and present only in:tray-app;nucleus.applicationdoes not pull it transitively.composenativetray-app→ core +nucleus.application+decorated-window-tao.TrayAppDemoend-to-end on macOS: tray created via the cross-moduleNativeTray, popup positioned from the injected Tao geometry (real screen bounds), shown/dismissed, clean exit.publishAndReleaseToMavenCentral) publishes both modules with no change, since the unqualified task runs in the root and every subproject that registers it.