LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2007, 09:57 AM   #1
atg2d
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Rep: Reputation: 0
Determine KDE or GNOME is running


Hi i need a simple way to determine whether KDE or GNOME is running. I am making an extension for Firefox and i need to run different programs depending on whether KDE or GNOME is running. I don't have access to any system variables in Firefox so it should be file based (see if a file is present or read contents of a file...). Currently i am checking if there is a file kdm.pid or gdm.pid in /var/run directory, but that really doesn't tell me anything as you can switch to gnome from KDM and kdm.pid will still be there.
I haven't been able to find anything in Google or this forum. But maybe i wasn't able to formulate correctly the search terms. If you can at least give me some pointers i'll be very grateful.
Thank you.
 
Old 12-02-2007, 11:54 AM   #2
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
About the only thing I can think of would be running pidof gdm or pidof kdm, and checking the results. Although this wouldn't work if you had both running.
 
Old 12-02-2007, 02:40 PM   #3
atg2d
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you
Problem is there is no functionality in Firefox that allows me to get the result from externally executed program, or i haven't found it yet but i have been searching for this for a long time and have seen questions about that unanswered so i think it is not possible. However i could run pidof and redirect its output to a file which i can then read. But i am reluctant to so that because in order to know when to read the file i must run a function that will block until the external program finishes. The problem is that it will block the entire Firefox interface and if something goes wrong it will stay locked which is not very good user experience.
Maybe there is another way to get this data? Where does pidof take its data? Is it possible that i take it from the same place? May be from /proc directory? And doing pidof kdm/gdm wouldn't that be the same as checking the files i mentioned in /var/run - which i am doing now?
Thank you again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running KDE and GNOME apps under another WM Denadai Linux - Software 5 07-01-2007 03:31 PM
KDE and Gnome running at the same time? Schreiberling General 16 09-17-2006 03:54 AM
Running KDE and Gnome on Suse 10 mjt Linux - General 3 11-09-2005 05:43 AM
Running Gnome apps in KDE PDR60 Slackware 1 11-24-2003 09:18 AM
KDE and GNOME running together jsatherley Linux - General 7 11-11-2002 02:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration