Re: How to detect a gtk desktop programmatically



I'd like to disclaim that since I'm not an OpenJDK developer, the upstream decision may very-well be to attempt to load Gtk when the system is anything other than Windows or MacOS.  I can't speak on behalf of the end-strategy of OpenJDK and I do not represent them or their solution to this problem.

That said, for reasons mentioned above as well as evidence in Gnome's codebase, Debian's codebase and Java's codebase, I observe a valid use-case for asking if the desktop environment is Gtk-based.  To deny that suggests that solutions which check are invalid, or contain no value and I believe this perspective to be short-sighted as admittingly my sight is as well.

-Tres



On Wed, Apr 29, 2020 at 5:03 PM Tres Finocchiaro <tres finocchiaro gmail com> wrote:
The best you can do is have a mapping of common DEs to their preferred
toolkits

This would mean each Gtk-based DE will require a patch to OpenJDK, which is unsustainable. 

There is no such thing as GTK desktop

Wikipedia has its own category: https://en.wikipedia.org/wiki/Category:Desktop_environments_based_on_GTK

In regards to Gtk2 versus Gtk3 binding, those issues haven't changed as results of this missing variable.  To request an environmental variable which exposes this is a reasonable request.  I'm not sure I understand the reluctance to provide such information.



On Wed, Apr 29, 2020 at 4:46 PM <jtojnar gmail com> wrote:
On Wed, 2020-04-29 at 15:59 -0400, Tres Finocchiaro via desktop-devel-
list wrote:
> I'm asking how to detect a Gtk desktop.  An answer that says "always'
> isn't really correct.  The use-cases for this -- as indicated by the
> Debian search results in the commit that removed this flag -- were in
> the hundreds.

There is no such thing as GTK desktop. Some desktops like GNOME or
Pantheon use GTK 3 a lot, others like KDE or LXQt use predominantly Qt,
but that is more of a social custom than technical feature that can be
detected.

For lot of environments it is not even clear cut as that: Xfce only
just recently managed to migrate most of its apps to GTK 3 but some
still remain on GTK 2, Deepin has weird mix of GTK, Qt and other
things, Enligthenment uses its own EFL… And that is not mentioning the
tens of “light” WMs/DMs like Openbox, Sway or XMonad that have no
toolkit at all and rely purely on user’s preferences.

The best you can do is have a mapping of common DEs to their preferred
toolkits but, as Ray mentions, given that you only support GTK and
¿Motif?, all modern Linux DEs (e.g. those that set the
`XDG_CURRENT_DESKTOP` variable to something) will prefer GTK when
available. Though it is good idea to add an environment variable like
`JAVA_AWT_TOOLKIT` so that people can switch to Motif if they for some
reason do want to use that.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]