-
Notifications
You must be signed in to change notification settings - Fork 13
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
Java Swing applications (SWT) lack Desktop integration #15
Comments
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
Well, diving a bit more in the Java source, I just sent PR #16 to replace those with a call to |
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
even when there's no GTK installed, by replacing gnome_url_show() (which also may call gtk_show_uri()) by 'xdg-open' command, which will work in any desktop and not only GTK/Gnome. It also works when using the minimal Freedesktop runtime, which many Java apps are built upon. flathub#15
by replacing gnome_url_show() call (it may also call gtk_show_uri()) by a 'xdg-open' command, which will work inside the flatpak sandbox, and for any desktop environment not just GTK/Gnome. Many Java apps in flathub are SWT apps which are built upon the minimal Freedesktop runtime, and they are currently broken with respect to launch web links or open local files, this commit patches the Desktop class so it can work under the sandbox. flathub#15
Opening URLs is not the only problem here — file chooser dialogs are as well. It'd be great if that was added too. Or, alternatively, if a new Java package was created that developers could use to easily integrate xdg-desktop-portal into Java apps. |
That would be cool, but I see that more as an enhancement, first we need to handle the issue here which is more of a bug, where many java apps are currently buggy in that they cannot open links or local files/directories (those which are allowed by --filesystem flag). But in your line, I think other buggy behaviours of java apps that may be patched further (after this gets accepted):
|
@nbenitez What license is your HiDPI support script? I'd like to use it in my own Flathub project — FOSStriangulator |
Public domain, no license. |
Wonderful, thank you! |
FWIW the Java UI framework SWT has full portal integration because it is built on GTK3 and uses all native chooser dialogs. This is how Eclipse (a large Java application) got full desktop portal integration -- it just inherits it from GTK3. |
I've been packaging Java GUI applications in flathub recently, they usually are multiplaform apps (Windows, Mac and Linux) which use Java Swing interface. And most of them fail to open url links from their dialogs or menu items (eg. to visit their project page or issue tracker, or to show their online documentation), another one also failed to launch file browser (eg. Nautilus) to show a local directory.
These apps all use a Java api for Desktop integration, which is the following Desktop class:
https://docs.oracle.com/javase/9/docs/api/java/awt/Desktop.html
Unfortunately, the linux desktop integration in java is very old and outdated, it uses the
gnome_url_show()
call which is provided by deprecated librarylibgnome
which is not even present in modern linux distros. See below howgnome_url_show()
is used in the Java source code:https://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java#l119
So, in order for Java Swing applications to work well in their Desktop integration I propose to add a small patch to openjdk extension to replace the
gnome_url_show()
call for one ofxdg-open
so it works perfectly fine under flatpak when the app manifest also includes the flatpak-xdg-utils module.Related issue: flatpak/xdg-desktop-portal#519
The text was updated successfully, but these errors were encountered: