Open browser

Is there a way to open a browser window from ruby, that works on
windows, linux and macos?

thx ck

Check out launchy. Its good for opening native applications.

http://rubyforge.org/projects/copiousfreetime/

launchy is there (used by heel).

On Dec 6, 2007, at 5:52 AM, Christian K. wrote:

Is there a way to open a browser window from ruby, that works on
windows, linux and macos?

Not really easily.
You could possibly write code for each OS and many different possible
browsers, then wrap all of it with a detect system function that
which system to run code for, then check for browsers you can open…

However, if you’re considering using a web-based user-interface for
cross-platform, that’s not a bad idea.
Thus the easiest way to open a browser window on 3 platforms is to
get users to click on a link or bookmark!

thefed wrote:

Check out launchy. Its good for opening native applications.

http://rubyforge.org/projects/copiousfreetime/

launchy is there (used by heel).

I installed this launchy gem and it works in general, but obviously not
in my context. I have a small wxruby app with just a task bar tray menu.
When i click on this tray icon i want the appolication to open the
browser and point to a certain address. The launchy call is processed
when i kill the application, not at clicking time.

any ideas? thx ck

On Dec 6, 2007, at 1:47 PM, Christian K. wrote:

menu.
When i click on this tray icon i want the appolication to open the
browser and point to a certain address. The launchy call is processed
when i kill the application, not at clicking time.

The basic idea in pseudocode would be:

command = windows ? ‘start /B’ : macosx ? ‘open’ : ‘???’
system(%Q[#{command} “#{url}”])

The /B flag prevents start from creating a Window on Windows.

Problem is I don’t think there’s a cross-desktop/window manager
launcher for Linux. You could look for “/usr/bin/firefox” or whatever
but what if it is there but user’s default browser is Konqueror?

– fxn

On Dec 6, 2007, at 8:45 AM, Xavier N. wrote:

Problem is I don’t think there’s a cross-desktop/window manager
launcher for Linux. You could look for “/usr/bin/firefox” or
whatever but what if it is there but user’s default browser is
Konqueror?

it’s called ‘htmlview’

a @ http://codeforpeople.com/

On Dec 6, 2007 6:47 AM, Christian K.
[email protected]
wrote:

browser and point to a certain address. The launchy call is processed
when i kill the application, not at clicking time.

Have you tried forking, or launching a new ruby process to execute the
launchy call?

On Dec 6, 2007, at 3:00 PM, Xavier N. wrote:

Is it normally installed?

it’s pretty common - but not universal. i would think something like

system “htmlview #{ uri } || firefox #{ uri } || mozilla #{ uri }”

etc would work. see what launchy does.

a @ http://codeforpeople.com/

Xavier N. wrote:

Problem is I don’t think there’s a cross-desktop/window manager launcher
for Linux. You could look for “/usr/bin/firefox” or whatever but what if
it is there but user’s default browser is Konqueror?

The general opener in KDE is:

kfmclient exec

Christian K. wrote:

Is there a way to open a browser window from ruby, that works on
windows, linux and macos?

thx ck

I’m not 100% sure, but I think you can just launch a URL in Windows and
it will open your default web browser at that page.

On Fri, Dec 07, 2007 at 06:19:32AM +0900, Tanner B. wrote:

I installed this launchy gem and it works in general, but obviously not
in my context. I have a small wxruby app with just a task bar tray menu.
When i click on this tray icon i want the appolication to open the
browser and point to a certain address. The launchy call is processed
when i kill the application, not at clicking time.

Have you tried forking, or launching a new ruby process to execute the
launchy call?

launchy does the forking internally for those OS’s that support it.

enjoy,

-jeremy

On Fri, Dec 07, 2007 at 07:46:17AM +0900, ara.t.howard wrote:

Yup, this is sort of what launchy does on linux. Its a bit more
complicated, but something like this is the fall back.

enjoy,

-jeremy

On Dec 6, 2007, at 10:31 PM, ara.t.howard wrote:

Problem is I don’t think there’s a cross-desktop/window manager
launcher for Linux. You could look for “/usr/bin/firefox” or
whatever but what if it is there but user’s default browser is
Konqueror?

it’s called ‘htmlview’

Is it normally installed?