You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

marcin

Beginner

  • "marcin" started this thread

Posts: 3

Location: Ottawa, ON, Canada

  • Send private message

1

Monday, November 13th 2006, 10:35pm

How to detect default browser from a script?

Hi, everyone

In my research I found a way to determine a default browser from a script in gnome, but am having much harder time in kde. Someone mentioned DCOP as a way to get that information, but there was not enough details to make it work. Does anyone here have more insight into that problem? I would really appreciate a pointer or two. Thanks.

Marcin

2

Monday, November 13th 2006, 10:59pm

What do you mean default browser? I select the browser I want to use in KDE in the Control Panel, under KDE Components - Component Chooser - Web Browser. I think that is only followed by applications built around the KDE framework though - others (like gaim) have that option built in.

marcin

Beginner

  • "marcin" started this thread

Posts: 3

Location: Ottawa, ON, Canada

  • Send private message

3

Monday, November 13th 2006, 11:56pm

What I'm trying to do is to detect from a script a default browser on a particular machine under kde. Different default browser may be selected by a user: firefox, konqueror, mozilla, epiphany, etc. I have to open an HTTP connection to a specific web site and it would be polite to use the browser which was selected by that user. So, to be specific, I'm looking for a file which contains that default browser name, or for an output of a command, which will give me that name. For example, in gnome I can use the following:

# gconftool-2 --get /desktop/gnome/url-handlers/http/command

and it produces the following output:

firefox %s

4

Saturday, November 25th 2006, 9:46pm

I don't think there is a way to use DCOP to find out KDE's default browser.
DCOP is for Inter-process communication, so I guess sycoca (KDE's system configuration cache) might be worth looking into.
However, a workaround might be to simply grep it from the configuration file itself.
It's set in BrowserApplication=... , in the file $HOME/.kde/share/config/kdeglobals

Sadly there is no consistent, cross-distribution desktop-environment-independent way to find out the default browser.
Debian, and probably other Debian-based distros, provide the script 'sensible-browser'. Also, many programs used to evaluate the $BROWSER shell variable.

hope that helps

cheers
fabian

marcin

Beginner

  • "marcin" started this thread

Posts: 3

Location: Ottawa, ON, Canada

  • Send private message

5

Monday, November 27th 2006, 7:22pm

Hi, fabian

Thanks for your reply. I checked SuSE 9.0, 9.3 and 10.1 and none of them had the $BROWSER variable set or had BrowserApplication set in $HOME/.kde/share/config/kdeglobals. I checked both root and user accounts... The search continues.

Regards

Marcin

This post has been edited 1 times, last edit by "marcin" (Nov 27th 2006, 7:23pm)