LinuxQuestions.org
Help answer threads with 0 replies.
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 07-14-2004, 09:45 AM   #1
ashusharma
LQ Newbie
 
Registered: Dec 2003
Distribution: Redhat Linux 8.0
Posts: 17

Rep: Reputation: 0
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
 
Old 07-14-2004, 09:54 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
What distribution are you running? Try going to a term and running "xwmconfig"
 
Old 07-14-2004, 10:37 AM   #3
ashusharma
LQ Newbie
 
Registered: Dec 2003
Distribution: Redhat Linux 8.0
Posts: 17

Original Poster
Rep: Reputation: 0
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.
 
Old 07-14-2004, 10:38 AM   #4
ashusharma
LQ Newbie
 
Registered: Dec 2003
Distribution: Redhat Linux 8.0
Posts: 17

Original Poster
Rep: Reputation: 0
I'm sorry, but xwmconfig was not found on the system. I'm running Redhat 8.0.
 
Old 07-14-2004, 10:40 AM   #5
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
You should edit your User CP and add your distribution so that those
trying to help you at least know what you're running.
 
Old 07-14-2004, 11:41 AM   #6
ashusharma
LQ Newbie
 
Registered: Dec 2003
Distribution: Redhat Linux 8.0
Posts: 17

Original Poster
Rep: Reputation: 0
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.
 
Old 07-14-2004, 06:27 PM   #7
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
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.
 
Old 07-15-2004, 03:19 AM   #8
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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.
 
Old 07-15-2004, 09:01 AM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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
 
  


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
Finding best way to hook up Linux laptop to WinXP desktop spywaremagnet Linux - Networking 3 07-30-2005 01:44 PM
finding out the current codec in Mplayer? Kilahchris Linux - Software 2 05-04-2004 01:53 PM
Finding information about the current shell atirya_yodha Linux - Newbie 3 03-18-2004 01:30 PM
finding current kernel config? reetep Linux - Newbie 2 12-31-2003 05:43 AM
Finding current load on the system kbeaver Linux - Newbie 2 09-04-2003 10:41 PM

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

All times are GMT -5. The time now is 10:23 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