This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes How to findout if GNOME or KDE is running Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to findout if GNOME or KDE is running" Watch "How to findout if GNOME or KDE is running" New topic
Author

How to findout if GNOME or KDE is running

V Chauhan
Ranch Hand

Joined: Nov 15, 2002
Posts: 70
Hi,

I need to find out (using a Shell script/ C program), whether GNOME or KDE is running as the current Desktop manager.

Is there a way to accomplish this? There are some environment variables specific to these ( for example GNOME_DESKTOP_SESSION_ID and GDMSESSION), but I am not sure about the significance of these variables and whether they will always be set with some value?

Will appreciate any thoughts/help on this.

Thanks.
Basu.
Richard Anderson
Ranch Hand

Joined: May 20, 2005
Posts: 61
One thing your could do is write a shell script that could examine the current processes that are running and see if gnome-session or kde-session is running. That should give you an idea of what environment is being used.

I did find one post out there that might be of use.

Gnome or KDE


-Rich, SCJP 1.4
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
Following command will return "1" if it is a gnome:
w -sh | grep gnome | wc -l

If not, it will return 0.

You can use it in your bash / ksh


SCJP2
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Or:


http://home.arcor.de/hirnstrom/bewerbung
V Chauhan
Ranch Hand

Joined: Nov 15, 2002
Posts: 70
Thanks a ton for your replies.
:-)
Basu.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to findout if GNOME or KDE is running
 
Similar Threads
Show me yours; I'll show you mine...
KDE won't start!
KDE ICQ GNOME
Nautilus file manager
Should I focus on Red hat or Mandrake 10.0 official?