Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: Tray icon and minimize to tray on Linux #234

Open
sorcererlc opened this issue Sep 24, 2024 · 25 comments · May be fixed by #226
Open

[Feature request]: Tray icon and minimize to tray on Linux #234

sorcererlc opened this issue Sep 24, 2024 · 25 comments · May be fixed by #226
Assignees
Labels
enhancement New feature or request feature request keep don't stale this issue Linux

Comments

@sorcererlc
Copy link

Is your feature request related to a problem? Please describe

Not really a problem, more an inconvenience of having the Luciferin window open all the time.

Describe the solution you'd like

I would like to have a tray icon and the ability to hide the main window on Linux like I had on Windows.

Describe alternatives you've considered

No response

@sblantipodi sblantipodi added enhancement New feature or request feature request keep don't stale this issue Linux labels Sep 24, 2024
@sblantipodi
Copy link
Owner

sblantipodi commented Sep 24, 2024

Hi @sorcererlc,
thanks for the suggestion.

This is something I've wanted to do for a long time, adding the keep label until the feature will be implemented.

sblantipodi added a commit that referenced this issue Sep 24, 2024
@sblantipodi sblantipodi linked a pull request Sep 24, 2024 that will close this issue
@sblantipodi sblantipodi linked a pull request Sep 24, 2024 that will close this issue
@sblantipodi
Copy link
Owner

sblantipodi commented Sep 25, 2024

Just to inform you @sorcererlc that this feature has been implemented and it will be released in the next release.

if you don't want to wait for the next release you can download the nighly build here

feel free to share some feedbacks if you find something that can be improved. thanks!

@sorcererlc
Copy link
Author

I downloaded and ran the nightly build but there's no tray icon being created.

If it helps with anything, I'm using GTK to generate a system tray widget.

Another thing I just thought of that would be nice is a configuration option to minimize to tray instead of quitting when closing the main window. This would be a great help for people who don't have window decorations like a title bar and a minimize button.

@sblantipodi
Copy link
Owner

sblantipodi commented Sep 25, 2024

mmm... on Ubuntu 24.04, GNOME 26 (X11 and Wayland) and KDE Plasma the tray icon works as in Windows,
if you click the X, it simply minimize to tray.

if this is not the case on your system it means that your system returns false to this method call
SystemTray.isSupported()

probably the GTK widget you are using does not notify the OS that the tray is supported with it.

can you remember me your OS details please? Are you using GNOME?

if you want to try it I have created another build that "skip the check if tray is supported" and act like if it's suppoted.
can you see if this improves the situation?

if yes, next step would be to understand why the widget you are using does not notify the OS about the tray support.

@sorcererlc
Copy link
Author

I am running Hyprland on Arch Linux and I am using ags for the system tray widget.

The latest build throws an exception when starting

[Instance #1] 19:14:02.565 [JavaFX Application Thread] INFO  org.dpsoftware.FireflyLuciferin - ** Log level -> INFO **
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: The system tray is not supported on the current platform.
	at java.desktop/java.awt.SystemTray.getSystemTray(Unknown Source)
	at org.dpsoftware.gui.TrayIconManager.initTray(TrayIconManager.java:237)
	at org.dpsoftware.FireflyLuciferin.start(FireflyLuciferin.java:261)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:264)
	... 1 more

@sblantipodi
Copy link
Owner

what are the programs that you are running with AGS that works well?
does it support only GTK programs?

it's weird that Java isn't able to detect the tray support.

@sorcererlc
Copy link
Author

Electron apps like Slack and Discord work. Also Vivaldi, Steam, OpenRGB and Telegram.
As far as I know they're all written in C/C++ but I don't know what bindings they use to integrate with the system tray.

@sblantipodi
Copy link
Owner

it seems that xembed-sni-proxy could help.
as far as I understand xembed-sni-proxy is now part of Plasma and should work on KDE, GNOME and similar.

can you install xembed-sni-proxy and give it a try?

@sorcererlc
Copy link
Author

sorcererlc commented Sep 26, 2024

There doesn't seem to be an individual package available for Arch anymore and the AUR package is marked as deprecated so I'm reluctant to install it.

I am using XWayland to provide some compatibility with X11 software and if that's not working I'm assumimg it won't work at all without Java providing proper Wayland support.
There seems to be some work done in that direction by the OpenJDK team with Wakefield but it looks like it's far from being usable.

@sblantipodi
Copy link
Owner

that package has been merged in plasma so it shouldn't be too bad, you could consider to create an image of your disk if you are worried about "breaking things", install the package and revert back if something broke :)

I don't think that it's a JavaFX problem it's just that Java (AWT) uses xembed instead of SNI for the tray icon.

@sorcererlc
Copy link
Author

sorcererlc commented Sep 29, 2024

It has indeed been merged into plasma but that's the problem, there's no individual package available anymore. The AUR package is marked deprecated.

Just for laughs I tried installing it anyway and both yay and paru complained that "No AUR package found for xembed-sni-proxy-git". I also tried building it from source but that also failed as I'm missing some X libraries.

Edit: I installed snixembed which seems to do the same thing but it fails to launch.

@sblantipodi
Copy link
Owner

I haven't answered yet because I'm still trying to find a solution for systems that lacks xembed.

Tray icon is managed by AWT and not by JavaFx and AWT is still using xembed.

@sorcererlc
Copy link
Author

No worries, take your time.
For now I just have a rule in hyprland to banish that window to a workspace I don't use :)

@sblantipodi sblantipodi removed a link to a pull request Nov 8, 2024
@sblantipodi
Copy link
Owner

stay tuned ;)

Screenshot From 2024-11-11 21-33-09

@sblantipodi
Copy link
Owner

sblantipodi commented Nov 15, 2024

hi @sorcererlc,
new build is available here

this build uses the latest possible tray icon system on Linux
(libayatana-appindicator or libappindicator) if you don't have it, you can install it with pacman.

there is another new feature.
if you have libnotify installed (pretty all linux distros bundles it), notification are now less intrusive using the OS notification system (less dialogs, more notifications).

if you want to give it a try, you know where to download it, if you prefer to wait for the final release, it's fine :)

EDIT: if you want to revert to the latest stable once installed this new beta, you need to manually edit the FireflyLuciferin.yaml and remove this entry:
trayPreference: "AUTO"

reverting back is not needed if it works well for you.

@sorcererlc
Copy link
Author

sorcererlc commented Nov 15, 2024

Hi there,

I installed the new build and so far it works great. The AGS/GTK system tray now picks up Luciferin's icon (and updates when Luciferin changes states), the menu works and the main window starts minimized.
image

Since moving to Linux I haven't seen many notifications from Luciferin. On Windows I was getting the frame rate popup quite often while gaming but on Linux it doesn't seem to complain very much. I do have libnotify installed as a dependency for swaync so we'll see how it goes.

I'll keep trying to break it over the next days but so far I have to say great job :)

@sblantipodi
Copy link
Owner

if you want to try notifications it's very simple:

  • go to settings
  • devices tab
  • click manage satellites
  • click the + button

it should complain that it lacks a valid ip address. this is just a method to test the notifications :)

thank you for the feedback and the continued support sorcererlc, it's much appreciated 👍

@sorcererlc
Copy link
Author

Nice. Notification integration works too :)
image

@sblantipodi
Copy link
Owner

ok. thank you very much :)

@Nyxis0
Copy link

Nyxis0 commented Nov 19, 2024

Could you guys guide me how to get this working in Arch?

@sblantipodi
Copy link
Owner

@Nyxis0 Arch is not different from others distros.
just download the .deb package, install it and start it some infos here

@sorcererlc
Copy link
Author

@Nyxis0 While it is possible to install .deb packages on Arch it's generally not recommended because it can cause conflicts with pacman. The recommended method is to clone the source and create a PKGBUILD that can then be installed using pacman.

Personally, I installed from the .rpm package. I just extracted it and copied the files to /opt. I also copied the .desktop file to /usr/share/applications so it would get picked up by the the app launcher.

@sblantipodi
Copy link
Owner

sorcerlc is obviously more competent than me on the arch side, so listen to him :D
I use Linux for 30 years in various flavours but never used Arch...

I am trying to understand how to publish the app on flatpak and snap but it will take some time.
In the mean time I would be very happy to add a specific build for arch but I need to understand how to do it first :)

@sorcererlc
Copy link
Author

I would say that my competency with Arch is mediocre at best. I've only running using Arch for the past two months or so. But I did learn a lot about it and Linux in general during this time, by necessity really, since Arch just left me with a TTY and told me to deal with it :D

I haven't messed with PKGBUILD yet but according to the wiki it should be relatively straight forward since you already have the build system in place. If you're using Github Actions or some other CI system you should even be able to provide a -bin release so people don't have to install build dependencies and build from source every time if they only want so use stable releases.
Major bonus points if you also decide to publish to AUR :)

I'd be happy to help with testing if you decide to try it.
Maybe we should move this to another issue so we don't completely hijack the initial topic?

@sblantipodi
Copy link
Owner

sblantipodi commented Nov 20, 2024

Maybe we should move this to another issue so we don't completely hijack the initial topic?

agree, opened a feature request here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request keep don't stale this issue Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants