Re: programmatically determining the desktop environment of a system
- Date: Fri, 17 Mar 2017 20:09:31 -0700
- From: Dan Hitt <dan.hitt@xxxxxxxxx>
- Subject: Re: programmatically determining the desktop environment of a system
Thanks Dominik, Steve, and Tomas for your mail.
For reference, Steve Litt responded to me privately to consider first
running 'ps axjf' by hand, in which case the environment should be
obvious, presumably doing this in a few different environments, and
then attempting to write some parsing code which goes through the same
mental steps. Certainly sounds reasonable absent an api, so thanks
Steve for the suggestion.
Thanks Dominik for the stack exchange link, which is basically the
same question (except that i would not be programming it in bash),
with some interesting ideas about environment variables to inspect.
(Part of the SE discussion in fact suggests using ps.)
Finally thanks for your response Tomas, with which i think most people
That is, i think usually the best practice is to do capability
detection (like the autoconf apparatus or jquery does) and then use
whatever capabilities you detect.
I'm not sure this is always possible, though, because if it is
something about the using the hardware in a certain way you may not be
able to detect this (but rather rely on what you know about the
I was sort of hoping that somebody would answer saying "Use the foo()
function in the XYZ api". Then at least i'd know to go find the XYZ
api and study it, because it would probably have a lot of other
goodies in it as well. And i'm still interested in that, but given
Dominick's reference i'm kind of doubtful i'll find it.
Anyhow, thanks again everybody for your help! :)
On Fri, Mar 17, 2017 at 1:02 AM, <tomas@xxxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Thu, Mar 16, 2017 at 10:17:37PM -0700, Dan Hitt wrote:
>> Is there a programmatic way that a piece of software can learn what
>> desktop environment it is executing in?
> Just out of curiosity: what is (roughly) your use case?
> (Personally I think it's a bad idea, but I'd like to learn)
> - -- t
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> -----END PGP SIGNATURE-----