Re: How to detect a gtk desktop programmatically

Michael Catanzaro <[email protected]> Thu, 30 Apr 2020 11:23:41 -0500
Newsgroups gmane.comp.gnome.desktop
Message-ID <[email protected]>
On Wed, Apr 29, 2020 at 8:16 pm, Tres Finocchiaro via 
desktop-devel-list <[email protected]> wrote:
> As an aside -- as a Java developer, I've personally never forced the 
> Gtk theme in my applications -- because back when I used KDE the Gtk 
> theming wasn't very good.  From the comments above it sounds like the 
> mailing list is fairly comfortable stating that the Java Gtk theme 
> should simply be default for all Java applications on Linux and I'd 
> be happy to begin testing that theory as it may help simplify the 
> downstream implementation that OpenJDK chooses to implement.

Well it sounds like everyone here agrees it's the best choice 
everywhere today. If you had a Qt theme, you would want to prefer that 
when running on KDE or LXQt, and use GTK everywhere else. You would 
want to detect those two desktops using $XDG_CURRENT_DESKTOP. But you 
don't have a Qt theme, so best use GTK everywhere and you don't need to 
bother with any environment variables. Simple.

I would worry about the future, though. I'm skeptical that updating to 
GTK 4 will ever be possible (due to the removal of the foreign drawing 
API that allows non-GTK apps to render boxes and buttons and such using 
the GTK theme). So even if it's the best option today, I don't see much 
long-term future here. I'm not sure what the Java community should be 
doing, but probably thinking about this early would be better than 
waiting until GTK 4 is released and it's too late for major changes.