Includefile - detect a browser/ all available browsers/ KDE

Linux specific forum
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Includefile - detect a browser/ all available browsers/ KDE

Post 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
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post 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/")
Image Image
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post 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
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post 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...
Image Image
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

hmm... I'd thought, this is a "standard" command...
Which distro you're using? (I'm running Kubuntu)
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post by WishMaster »

SuSE, of course.
Image Image
Post Reply