Re: How to detect a gtk desktop programmatically



How do they decide if they should use GTK 3 or GTK 2?

I had to research this, but apparently they made a cut-over at some point. https://bugs.openjdk.java.net/browse/JDK-8198649 (not attempting to minimize the problem, just wanted to isolate it from what we're discussing)

And even if someone decides to standardize it and sends merge requests
to all major desktop environments, it will still take ages before it is
widely available.

That's an unfortunate truth which is why I was hoping for an alternative way to detect this.

At time of writing this, Ubuntu's the only one I've found modifying XDG_CURRENT_DESKTOP and keep something indicative of Gtk inside e.g. (ubuntu:GNOME).   I assume that's because they've ditched Unity and are finally back to using Gnome, but in a customized form; whereas the others are simply Gtk-based and use their own name.

It would be nice to have a consensus on a long-term supported property that exposes the presence of a running Gtk-based desktop to application developers.  Even if such a value provides presumptuous information, it's information, which is valuable.

If this consensus were agreed upon, the 80/20 stop-gaps of the world would become the new "deprecated; a path to detection would be sanctioned, instead of a mispurposed one.





On Wed, Apr 29, 2020 at 5:40 PM <jtojnar gmail com> wrote:
On Wed, 2020-04-29 at 17:03 -0400, Tres Finocchiaro 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.

I agree that this is inconvenient but in the absence of a better
option, you either make a list, or come up with some heuristic.

> > There is no such thing as GTK desktop
>
> Wikipedia has its own category:
> https://en.wikipedia.org/wiki/Category:Desktop_environments_based_on_GTK

But that is only what people see. Desktops do not care about toolkits,
only thing that matters is that the app can connect to the desktop’s
display server.

And while it would be possible to make desktops record the consensus on
the preference of toolkits in their respective communities and expose
it via some API like an environment variable, someone would need to
come up with the API and then convince all desktop environments it is
something they should implement.

Given the limited usefulness of such API, I do not see anyone spending
time on that effort.

And even if someone decides to standardize it and sends merge requests
to all major desktop environments, it will still take ages before it is
widely available.

> In regards to Gtk2 versus Gtk3 binding, those issues haven't changed
> as results of this missing variable.

How do they decide if they should use GTK 3 or GTK 2?

> I'm not sure I understand the reluctance to provide such information.

I do not think anyone is opposed to that but I doubt anyone will
consider it a priority. Especially since the intersection of
toolkits supported by AWT and toolkits prefered can be emulated using
much simpler algorithm.

preferred | GTK | Qt  | EFL
----------|-----|-----|-----|
has GTK   | GTK | GTK | GTK |
no GTK    |error|Motif|Motif|



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