Command used to view desktop envorinoment

Jacques B. jjrboucher at gmail.com
Mon Sep 11 04:08:56 UTC 2006


On 9/10/06, Chhun Vanna <chhvanna at gmail.com> wrote:
> Dear all
>  any body can help me with linux command to view my current desktopn
> enviornment?
>  i just want to show m desktop is KDE or GNOME?
>  I try to search with switchdesk command but it does not sounds what i want.
>
> --
> Chhun Vanna

The file /etc/sysconfig/desktop will contain either
DESKTOP=KDE

or
DESKTOP=GNOME

Not sure if there is an environment variable for that (not in Linux
right now.  You could try "env", as well as "set" to see if either
have an environment variable showing which desktop you are using).

So you can at least get it from /etc/sysconfig/desktop.  If you want
to assign it to a variable, use:

mydesktop=$(cat /etc/sysconfig/desktop | grep DESKTOP | awk -F \= '{print $2}')

I'm assuming you are wondering about this because you want to have a
script do one thing if in Gnome, but something else if in KDE since
you are wondering if there is a Linux command to find out which
desktop you are using.

If you are simply looking to find out because you don't know which one
you are using, just do
cat /etc/sysconfig/desktop

and have a look at the output.

If nothing is specified, in Fedora Core at least I believe that means
the default Gnome desktop is the one being used currently.

Jacques B.




More information about the fedora-list mailing list