Skip to content

fix(linux): honor tray primary action in KDE - #443

Closed
BiFangKNT wants to merge 1 commit into
NucleusFramework:masterfrom
BiFangKNT:fix/linux-tray-primary-action
Closed

BiFangKNT wants to merge 1 commit into
NucleusFramework:masterfrom
BiFangKNT:fix/linux-tray-primary-action

Conversation

@BiFangKNT

Copy link
Copy Markdown

On KDE Plasma, a tray with a primary action still opens its menu on left click because the Linux SNI backend always advertises ItemIsMenu=true. This change derives the property from primary action availability, so left click invokes the action when present and opens the menu otherwise. Right-click menu behavior is preserved.

The Kotlin manager now synchronizes callback presence when the action is added or removed. These transitions emit both PropertiesChanged and NewTitle, which lets Plasma refresh its cached ItemIsMenu. Native callback access and JNI references are protected while callbacks are updated.

Validation:

  • Native D-Bus regression tests cover initial state, dynamic transitions, Plasma-style host cache refresh, activation, and context menus. The cache regression fails without the added SNI refresh signal.
  • Kotlin/JNI integration test covers adding, replacing, and removing the primary action.
  • Existing 200,000-round concurrency, pixmap, and JNI UTF-8 tests passed; ktlintCheck passed.
  • Linux x64 native library and JVM JAR built successfully; manually verified on Fedora KDE.

The new regression tests are included in CI.

Derive ItemIsMenu from primary action availability and synchronize
callback presence when the action changes. Emit NewTitle alongside
PropertiesChanged so Plasma refreshes its cached activation mode.

Protect click callback access across native and JNI threads. Add
D-Bus regression coverage for activation, host cache refresh, and
context menus, and run it in CI.

Verified with automated tests and manual testing on Fedora KDE.
@kdroidFilter

Copy link
Copy Markdown
Collaborator

Thank you! The code of this library now lives in the Nucleus repository (tray and tray-app modules), see the README and the migration guide. Nucleus already makes ItemIsMenu follow the primary action; the part it still lacks (emitting NewTitle so Plasma re-reads it when primaryAction changes at run time) continues in NucleusFramework/Nucleus#989. Closing here.

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.

2 participants