LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Finding what the current desktop is (http://www.linuxquestions.org/questions/programming-9/finding-what-the-current-desktop-is-204904/)

ashusharma 07-14-2004 10:45 AM

Finding what the current desktop is
 
Hi,

Is there a consistent/robust way of finding progammatically (or via a shell script) what desktop one is running - Gnome/KDE/etc?

Thanks in advance,
Ashutosh

Bruce Hill 07-14-2004 10:54 AM

What distribution are you running? Try going to a term and running "xwmconfig"

ashusharma 07-14-2004 11:37 AM

Basically, I am trying to write a program that would use the default browser and email client on a users linux system, without having the user to specify these in my program's preferences. So, the program (or its installer) needs to have a way to find what the current desktop is, so that some appropriate way (specific to the desktop) can be used to find these default applications.

ashusharma 07-14-2004 11:38 AM

I'm sorry, but xwmconfig was not found on the system. I'm running Redhat 8.0.

Bruce Hill 07-14-2004 11:40 AM

You should edit your User CP and add your distribution so that those
trying to help you at least know what you're running.

ashusharma 07-14-2004 12:41 PM

Done.
Basically, the problem is to find programmatically (or through a shell script) what system the progme gets run on after I give it to some one.

Bruce Hill 07-14-2004 07:27 PM

You should post back how you did that so someone searching who
finds this thread can learn from your experience. That's how a communal
forum works.

XavierP 07-15-2004 04:19 AM

ashusharma - I don't think your program will need to know what the default browser, etc is. If your program opens an html page, it will tell the system what it wants to do, the system will see that it can handle the request, it will check to see what program it uses to do this and will open it.

Chinaman - I think the "Done" was to say that Ashusharma had amended the distro entry in the side panel. :)

keefaz 07-15-2004 10:01 AM

You can use some test like :

Code:

#!/bin/bash

BROWSERLIST="mozilla konqueror galeon opera netscape"
BROWSER=

for i in $BROWSERLIST; do
    if which $i 1> /dev/null 2> /dev/null; then
        BROWSER=$(which $i)
        break
    fi
done

if [ -z "$BROWSER" ]; then
    echo "No known browser was found"
else
    echo "Found a workable browser : $BROWSER"
fi



All times are GMT -5. The time now is 02:37 AM.