Hi,

I come from Windows/Delphi (3.0) background and I'm gradually moving
towards Lazarus/fpc.

Opening an URL in Windows is a piece of cake, you just let the OS take
care of the assotiations with the http protocol to open it (using
shellexecute).
This of course will not do for other platforms.

So I set myself the task of launching an URL in an external browser on
other platforms.
Since I only have Linux (besides Win) I began with that.

I tried to find examples on the net, but had no luck.
I might well be re-inventing the wheel though...

Here's my approach:

- try to detect the windowmanger (for now I know how to do this for
KDE and GNOME, XFCE is on my whishlist)

On KDE
- lookup DESKTOK_LAUNCH environment variable
- if not there, look for kde-open
- if not there look for kfmclient
- if not there look for xdg-open
- if not there try fallback
(possibly using gnome-open might also work under KDE ???)

On GNOME
- look fo gnome-open
- if not there, look for xdg-open
- if not there try fallback

Fallback
- search for know browsers (firefox, iceweasel, mozilla, opera,
konqueror, ...(suggestions are welcome))

If browser (or URL handler like kde-open, xdg-open etc.) is found
launch it with the appropriate URL.

This approach (the finding mechanism) seems to work at least on my
Suse KDE desktop.

I would like your opinions on this approach, and better still, I would
like some suggestions how to achieve something similar on a Mac.
(I suppose on Mac OSX the linux approach should work also???)

And as a final rather dumb question: do all supported OS's have an
environmentvariable PATH (as this is used in the fallback mechanism)?

Bart
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to