Skip to content

Fix #316: add Linux-native tray fallback and notifications when AWT SystemTray is unavailable#317

Open
QuickMythril wants to merge 3 commits intoQortal:masterfrom
QuickMythril:bugfix/tray-icon
Open

Fix #316: add Linux-native tray fallback and notifications when AWT SystemTray is unavailable#317
QuickMythril wants to merge 3 commits intoQortal:masterfrom
QuickMythril:bugfix/tray-icon

Conversation

@QuickMythril
Copy link

Summary

Fixes #316 by making Qortal Core tray support work on Linux systems where java.awt.SystemTray is unsupported.

Root Cause

The existing tray implementation was AWT-only.
On many Linux desktop setups, SystemTray.isSupported() returns false, so tray initialization exited early and no icon/menu/notifications were available.

What This PR Changes

1) Add Linux-native tray backend fallback

  • Added com.dorkbox:SystemTray dependency in pom.xml.
  • SysTray now supports backend selection via:
    • -Dqortal.tray.backend=auto|awt|sni|appindicator|none
  • Default auto behavior:
    • Try AWT tray first (preserves current behavior where it works)
    • On Linux, fall back to Linux-native tray if AWT is unavailable

2) Improve backend diagnostics

  • Added startup logging for tray backend decisions:
    • requested backend
    • OS
    • headless state
    • AWT support
    • session/desktop env values

3) AppIndicator tooltip fallback

  • AppIndicator often does not support hover tooltips.
  • For Linux-native AppIndicator, tray text now falls back to status text (setStatus) instead of tooltip only.

4) Linux notification support

  • Linux-native backend now attempts desktop notifications via notify-send from showMessage(...).
  • If notify-send is unavailable/fails, it gracefully falls back to debug logging (no crash/regression).

Compatibility / Risk

  • Windows/macOS and Linux systems where AWT tray already works keep existing behavior.
  • Linux-native path is only used when selected or when auto fallback is needed.
  • No API changes to existing tray callers.

Commits Included

  1. 65fb8cfd feat(gui): add Linux-native system tray backend fallback
  2. 3cfc1254 fix(gui): fallback to status text for AppIndicator tray
  3. 139a3798 feat(gui): send Linux tray notifications via notify-send

Validation

  • Project compiles successfully (mvn -DskipTests compile).
  • Manual Linux verification with appindicator:
    • tray icon appears
    • tray menu works
    • status text updates
    • desktop notifications are shown

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.

Linux tray icon fails on many systems because SysTray requires AWT SystemTray with no Linux fallback

1 participant