Page 1 of 1

Includefile - detect a browser/ all available browsers/ KDE

Posted: Mon Jul 10, 2006 8:31 pm
by walker
Hi,

here is a small includefile with 3 functions I'd needed for my actual project
Hope, this is usefull for someone else:

Code: Select all

IsBrowserInstalled(browsername$) 
BrowserList() 
IsRunningKDE()
Simply uses existing Linux-commands....

How to Use:

Code: Select all

;
;Examples
;
Includefile "misc_functions.pb"

If IsBrowserInstalled("konqueror"); returns #True or #False
    RunProgram("konqueror")
EndIf    

Debug BrowserList() ; returns a stringfield with available browsers - fieldseperator = ;

If IsRunningKDE() ; returns #True or #False
    Debug "KDE is running"
EndIf
The list of known browsers can be obtained (and easily extended) in the includefile which can be downloaded here:

http://home.arcor.de/x-linux/pure/misc_functions.pb

Comments, suggestions etc. are appreciated

Posted: Tue Jul 18, 2006 7:11 pm
by WishMaster
There is quite an easy way to open an URL with KDE's standard browser.
(You can define the standard browser at Control Center|KDE Components|Component Chooser)

Code: Select all

System_("kfmclient openURL /url/or/path/")

Posted: Tue Jul 18, 2006 9:19 pm
by walker
Yes, that's true.. but this (with konqueror) was only an example..
It also works with

Code: Select all

IsBrowserInstalled("mozilla") 
or

Code: Select all

IsBrowserInstalled("firefox") 
etc...
and gives you the ability, to use another browser than standard (ie to give the user a list of available browsers for a choice) or detect if a required one is missing!

And btw. if you want to start the standard-browser defined, better use the command

Code: Select all

sensible-browser url

Posted: Tue Jul 18, 2006 9:51 pm
by WishMaster
> Yes, that's true.. but this (with konqueror) was only an example
kfmclient openURL doesn't start Konqueror.
It starts the browser the user has defined as his standard browser.

> sensible-browser url
If I enter this into my BASH it tells me that it couldn't find the command...

Posted: Thu Jul 20, 2006 12:07 am
by walker
hmm... I'd thought, this is a "standard" command...
Which distro you're using? (I'm running Kubuntu)

Posted: Thu Jul 20, 2006 12:27 pm
by WishMaster
SuSE, of course.