• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to findout if GNOME or KDE is running

 
V Chauhan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mahesh Rana
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or:
 
V Chauhan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton for your replies.
:-)
Basu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic