[ANN] launchy 0.1.2 Released

J

Jeremy Hinegardner

launchy version 0.1.2 has been released.

http://copiousfreetime.rubyforge.org/launchy/

Example:

Launchy.do_magic("http://www.rubyforge.org")

or

Launchy::Spawnable::Browser.new.visit("http://www.ruby-lang.org/")

Launchy is helper class for launching cross-platform applications in a
fire and forget manner.

There are application concepts (browser, email client, etc) that are common
across all platforms, and they may be launched differently on each
platform. Launchy is here to make a common approach to launching
external application from within ruby programs.

{{ Changelog for Version 0.1.2 }}

=== Version 0.1.2 - 2007-08-11

* first publicly announced release
* make forked child exit without calling at_exit handlers

enjoy,

-jeremy
 
T

Trans

launchy version 0.1.2 has been released.

http://copiousfreetime.rubyforge.org/launchy/

Example:

Launchy.do_magic("http://www.rubyforge.org")

or

Launchy::Spawnable::Browser.new.visit("http://www.ruby-lang.org/")

Launchy is helper class for launching cross-platform applications in a
fire and forget manner.

There are application concepts (browser, email client, etc) that are common
across all platforms, and they may be launched differently on each
platform. Launchy is here to make a common approach to launching
external application from within ruby programs.

{{ Changelog for Version 0.1.2 }}

=== Version 0.1.2 - 2007-08-11

* first publicly announced release
* make forked child exit without calling at_exit handlers

enjoy,

Looks very interesting. I might use this on one of my projects. Some
thoughts/questions:

* This is clearly useful for launching a browser. (which is what I
could use it for). But will it really be useful for anything else?
Maybe I can see launching an email program, but I'm not even sure
about that.

* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

* What is Launchy::Specification for, how is it used?

* If I may make a suggestion... I think the API would be nicer if you
did without the Spawnable namespace. Just Launchy::Browser would be
much nicer.

Nice work!
T.
 
S

Sebastian Hungerecker

Trans said:
On Aug 11, 11:51 pm, Jeremy Hinegardner wrote:

* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

According to the documentation on the homepage:
APP_LIST = { :windows => %w[ firefox iexplore ], :darwin => %w[ open ],
:nix => %w[ firefox ], :unknown => [], }
So on OSX it uses the default browser and on any other system firefox, if
installed, or IE or nothing. I have to say, I find that somewhat suboptimal.
Certainly it's possible to detect the default browser on Windows, KDE and
GNOME, too, right? (Although, of course, it's still possible that someone
has neither KDE or GNOME installed or that he has both and is running neither,
which would make it hard to choose which default browser to use on *nix).
 
O

Olivier Renaud

Le dimanche 12 ao=FBt 2007 11:53, Sebastian Hungerecker a =E9crit=A0:
Trans said:
* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

According to the documentation on the homepage:
APP_LIST =3D { :windows =3D> %w[ firefox iexplore ], :darwin =3D> %w[ ope= n ],

:nix =3D> %w[ firefox ], :unknown =3D> [], }

So on OSX it uses the default browser and on any other system firefox, if
installed, or IE or nothing. I have to say, I find that somewhat
suboptimal. Certainly it's possible to detect the default browser on
Windows, KDE and GNOME, too, right? (Although, of course, it's still
possible that someone has neither KDE or GNOME installed or that he has
both and is running neither, which would make it hard to choose which
default browser to use on *nix).

So, it won't work on my computer, since I run linux without firefox install=
ed.=20
Under Windows, there is a default browser that can be set by the user, it=20
would be great to use this one, though I don't know how to get it. Maybe fr=
om=20
the registry ?
Under *nix, there is a BROWSER environement variable (but it is not often=20
correctly set, unfortunately).
Also, there should be Mozilla in the executable list, as the default after=
=20
firefox.
But the best for me would be that konqueror is used as the browser, with yo=
ur=20
lib, since I run KDE. You can detect this from the env variable=20
DESKTOP_SESSION which is set to "kde".

=2D-=20
Olivier Renaud
 
D

Detlef Reichl

Am Sonntag, den 12.08.2007, 19:41 +0900 schrieb Olivier Renaud:
Le dimanche 12 août 2007 11:53, Sebastian Hungerecker a écrit :
Trans said:
On Aug 11, 11:51 pm, Jeremy Hinegardner wrote:
launchy version 0.1.2 has been released.

Launchy is helper class for launching cross-platform applications in a
fire and forget manner.

* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

According to the documentation on the homepage:
APP_LIST = { :windows => %w[ firefox iexplore ], :darwin => %w[ open ],

:nix => %w[ firefox ], :unknown => [], }

So on OSX it uses the default browser and on any other system firefox, if
installed, or IE or nothing. I have to say, I find that somewhat
suboptimal. Certainly it's possible to detect the default browser on
Windows, KDE and GNOME, too, right? (Although, of course, it's still
possible that someone has neither KDE or GNOME installed or that he has
both and is running neither, which would make it hard to choose which
default browser to use on *nix).

So, it won't work on my computer, since I run linux without firefox installed.
Under Windows, there is a default browser that can be set by the user, it
would be great to use this one, though I don't know how to get it. Maybe from
the registry ?
Under *nix, there is a BROWSER environement variable (but it is not often
correctly set, unfortunately).
Also, there should be Mozilla in the executable list, as the default after
firefox.
But the best for me would be that konqueror is used as the browser, with your
lib, since I run KDE. You can detect this from the env variable
DESKTOP_SESSION which is set to "kde".

Under GNOME the gconf key /desktop/gnome/url-handlers/http/command
contains the default browser.

Cheers
detlef
 
O

Olivier Renaud

But the best for me would be that konqueror is used as the browser, with
your lib, since I run KDE. You can detect this from the env variable
DESKTOP_SESSION which is set to "kde".

I answer to myself :
DESKTOP_SESSION doesn't seem to be reliable, since its values are not standard
(and often is equal to "default").
So, maybe the best bet is to check the existence of KDE_SESSION_UID or
GNOME_SESSION_ID, to know which desktop is run, if any.

By the way, I was looking for the equivalent of OSX's "open" and
Windows' "start" under *nix. There is the command "xdg-open" from the
freedesktop project, which does just that. It's already on my system, maybe
it is already widely installed on systems that follow freedesktop guidelines.
 
D

Daniel Schierbeck

--=-BhlAacdoJpnMT2CskNrb
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature";
boundary="=-gSxCo0hhDUjaOXdOACVa"


--=-gSxCo0hhDUjaOXdOACVa
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Am Sonntag, den 12.08.2007, 19:41 +0900 schrieb Olivier Renaud:
Le dimanche 12 ao=C3=BBt 2007 11:53, Sebastian Hungerecker a =C3=A9crit= :
Trans wrote:
On Aug 11, 11:51 pm, Jeremy Hinegardner wrote:
launchy version 0.1.2 has been released.

Launchy is helper class for launching cross-platform applications= in a
fire and forget manner.

* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

According to the documentation on the homepage:
APP_LIST =3D { :windows =3D> %w[ firefox iexplore ], :darwin =3D> %w[= open ],

:nix =3D> %w[ firefox ], :unknown =3D> [], }

So on OSX it uses the default browser and on any other system firefox= , if
installed, or IE or nothing. I have to say, I find that somewhat
suboptimal. Certainly it's possible to detect the default browser on
Windows, KDE and GNOME, too, right? (Although, of course, it's still
possible that someone has neither KDE or GNOME installed or that he h= as
both and is running neither, which would make it hard to choose which
default browser to use on *nix).
=20
So, it won't work on my computer, since I run linux without firefox ins= talled.=20
Under Windows, there is a default browser that can be set by the user, = it=20
would be great to use this one, though I don't know how to get it. Mayb= e from=20
the registry ?
Under *nix, there is a BROWSER environement variable (but it is not oft= en=20
correctly set, unfortunately).
Also, there should be Mozilla in the executable list, as the default af= ter=20
firefox.
But the best for me would be that konqueror is used as the browser, wit= h your=20
lib, since I run KDE. You can detect this from the env variable=20
DESKTOP_SESSION which is set to "kde".
=20
=20
Under GNOME the gconf key /desktop/gnome/url-handlers/http/command
contains the default browser.

Calling gnome-open with the URL accomplishes the goal more easily.


Cheers,
Daniel Schierbeck

--=-gSxCo0hhDUjaOXdOACVa
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBGvvfLE8pU4Gwf6g8RAgU9AKCRdhK14nasmSZDJG56vFhBOETvAgCgpxxT
lojdIUnhQbEzkGehvAT9keo=3D
=3D6xva
-----END PGP SIGNATURE-----

--=-gSxCo0hhDUjaOXdOACVa--

--=-BhlAacdoJpnMT2CskNrb
Content-Type: application/x-pkcs7-signature; name=smime.p7s
Content-Disposition: attachment; filename=smime.p7s
Content-Transfer-Encoding: base64

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIILGjCCBYkw
ggRxoAMCAQICBEOI1E4wDQYJKoZIhvcNAQEFBQAwMTELMAkGA1UEBhMCREsxDDAKBgNVBAoTA1RE
QzEUMBIGA1UEAxMLVERDIE9DRV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gKWpFbyaLjqyf62GU29rSN8KPD8CGiHslUTs76DmA5Cghd3
cFZCGXx9oqZnYhSWSvru4vaxeVhMieRMqv1oSNcGuZqOajipzuBhp9AkcLvv8CpN6jWxs4q1iZcf
zrgI8wAAAAAAAA==


--=-BhlAacdoJpnMT2CskNrb--
 
T

Trans

I answer to myself :
DESKTOP_SESSION doesn't seem to be reliable, since its values are not standard
(and often is equal to "default").
So, maybe the best bet is to check the existence of KDE_SESSION_UID or
GNOME_SESSION_ID, to know which desktop is run, if any.

By the way, I was looking for the equivalent of OSX's "open" and
Windows' "start" under *nix. There is the command "xdg-open" from the
freedesktop project, which does just that. It's already on my system, maybe
it is already widely installed on systems that follow freedesktop guidelines.

Interesting, but xdg-open opens Kate on my system.

T.
 
J

Jörg W Mittag

Olivier said:
Le dimanche 12 août 2007 11:53, Sebastian Hungerecker a écrit :
Trans said:
On Aug 11, 11:51 pm, Jeremy Hinegardner wrote:
launchy version 0.1.2 has been released.

Launchy is helper class for launching cross-platform applications in a
fire and forget manner.
* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?
According to the documentation on the homepage:
APP_LIST = { :windows => %w[ firefox iexplore ], :darwin => %w[ open ],
:nix => %w[ firefox ], :unknown => [], }
[...]
So, it won't work on my computer, since I run linux without firefox installed.
Under Windows, there is a default browser that can be set by the user, it
would be great to use this one, though I don't know how to get it. Maybe from
the registry ?

No need. Windows has had an equivalent to MacOS's 'open' since
Windows 95, I believe:

url = 'http://Ruby-Lang.Org/'
`start #{url}`

'start' will launch whatever application is registered to handle the
filetype (if the parameter is a file) or protocol (if the parameter is
a URI) in question -- in my case Opera.

So, just setting

Launchy::Spawnable::Browser::APP_LIST[:windows] = ['start']

*should* work, but, unfortunately, Launchy doesn't work for me at all,
so I can neither confirm nor deny that.

jwm
 
A

ara.t.howard

According to the documentation on the homepage:
APP_LIST = { :windows => %w[ firefox iexplore ], :darwin => %w
[ open ],
:nix => %w[ firefox ], :unknown => [], }
So on OSX it uses the default browser and on any other system
firefox, if
installed, or IE or nothing. I have to say, I find that somewhat
suboptimal.
Certainly it's possible to detect the default browser on Windows,
KDE and
GNOME, too, right? (Although, of course, it's still possible that
someone
has neither KDE or GNOME installed or that he has both and is
running neither,
which would make it hard to choose which default browser to use on
*nix).

but no patch? ;-)

i think it's pretty simple on *nix

launchy_browser = ENV['LAUNCHY_BROWSER']

autocmds = %w[ htmlview ] ### and which ever others exist
for kde, etc

realcmds = %w[ firefox mozilla ] ### and some others


cmds = [ launchy_browser, autocmds, realcmds ].flatten.map{|cmd|
"( #{ cmd } >/dev/null 2>&1 )"}

cmd = cmds.join ' || '

system cmd

you could do some detection crap, but simply having a preferred list
of 'commands that find browsers' followed by a reasonable list of
browsers is going to work on 99% of *nix boxes. for everyone else
they can set an env var and all will be well. any unix user that
can't manage to set environment vars to make non-standard setups work
does deserve to surf the web anyhow ;-)

cheers.



a @ http://drawohara.com/
 
A

ara.t.howard

I think this kind of defeats the purpose of Launchy though no? I
thought
the idea was to use the user's preferred browser instead of "a
browser" w/o
needing to config it. By making them set an env var to get the right
browser, there's really no point in using Launchy at all. Any nix ruby
script can easily query an env on it's lonesome, or try a list of
possible
browsers, I thought (correct me if I am wrong) was that the point
of Launchy
was to do the "hard part" of detecting the user's preferred browser.

the point of the environment var is for those cases when it cannot be
detected or, for example, debugging launchy itself - there is no
requirement to set it. letting users override stuff is the unix way
- trying to make a reasonable guess in all other cases is the realm
of applications like launchy. always guessing correctly is a very
tall order: the 'preferred' browser on our sysad machines is 'lynx'
because we do not run X, nevertheless we do use a browser for hitting
admin panels, etc. it's unreasonable to expect a library to run in
such an environment. in any case i think a reasonable algorithm, in
order of degredation, is

- use user provided default iff given

- use a preferred list of browser guessers (htmlview, for example)

- use a preferred list of browsers

- prompt user for browser, cache answer for next time


2 cts.

a @ http://drawohara.com/
 
J

Jeremy Hinegardner

Olivier said:
Le dimanche 12 ao?t 2007 11:53, Sebastian Hungerecker a ?crit?:
Trans wrote:
On Aug 11, 11:51 pm, Jeremy Hinegardner wrote:
launchy version 0.1.2 has been released.

Launchy is helper class for launching cross-platform applications in a
fire and forget manner.
* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?
According to the documentation on the homepage:
APP_LIST = { :windows => %w[ firefox iexplore ], :darwin => %w[ open ],
:nix => %w[ firefox ], :unknown => [], }
[...]
So, it won't work on my computer, since I run linux without firefox installed.
Under Windows, there is a default browser that can be set by the user, it
would be great to use this one, though I don't know how to get it. Maybe from
the registry ?

No need. Windows has had an equivalent to MacOS's 'open' since
Windows 95, I believe:

url = 'http://Ruby-Lang.Org/'
`start #{url}`

'start' will launch whatever application is registered to handle the
filetype (if the parameter is a file) or protocol (if the parameter is
a URI) in question -- in my case Opera.

So, just setting

Launchy::Spawnable::Browser::APP_LIST[:windows] = ['start']

*should* work, but, unfortunately, Launchy doesn't work for me at all,
so I can neither confirm nor deny that.

Thanks for the info, I personally don't have a windows machine to test
on so I was shooting from the hip here. I'll change the windows
launching and have a new release out today.

enjoy,

-jeremy
 
J

Jeremy Hinegardner

I agree mostly. However a lib with a method named "do_magic" should try very
hard to fulfill that implicit promise IMO. (And I don't see why xdg-open or
equivalent couldn't invoke lynx.) Man, I sound whiny today :)

Yes that is my goal, part of this release was to get feedback on other
ways to do things. I don't have 'every' system; so the feedback is
necessary for launchy to "do_magic".

Great feedback all around guys, I appreciate it. I'll put it all
together and have another release out today which will hopefully work
for even MORE users.

enjoy,

-jeremy
 
J

Jeremy Hinegardner

I answer to myself :
DESKTOP_SESSION doesn't seem to be reliable, since its values are not standard
(and often is equal to "default").
So, maybe the best bet is to check the existence of KDE_SESSION_UID or
GNOME_SESSION_ID, to know which desktop is run, if any.

By the way, I was looking for the equivalent of OSX's "open" and
Windows' "start" under *nix. There is the command "xdg-open" from the
freedesktop project, which does just that. It's already on my system, maybe
it is already widely installed on systems that follow freedesktop guidelines.

Thanks for the tip, xdg-open looks like a good thing, I'll incorporate
what I can.

Looks like there's lots of good things in xdg-utils.

enjoy,

-jeremy
 
J

Jeremy Hinegardner

Looks very interesting. I might use this on one of my projects. Some
thoughts/questions:

* This is clearly useful for launching a browser. (which is what I
could use it for). But will it really be useful for anything else?
Maybe I can see launching an email program, but I'm not even sure
about that.

I'm not sure either, I would like to add email programs for sure, other
applications, I don't know, I'll leave it open to be filled as there is
demand. Music players? Image viewers?
* How does it deal with a systems that have more than one browser
installed? Which browser does it choose?

I'm working on that, primarily it should use an 'autocmd' on each system
that can detect the preferred application on the system, then fall back
to reasonable defaults.
* What is Launchy::Specification for, how is it used?

I bootstrapped the development of Launchy with another project I'm
working on, rabal (http://copiousfreetime.rubyforge.org/rabal/).

Rabal generates directory structure, Rakefiles, some classes useful for
most applicaiton (version.rb, initial unit testing, license templates
etc.). specification.rb is a generated file from rabal and an instance
of the Launchy::Specification is in gemspec.rb. This instance is used by
the Rakefiles for project management and can be used from within the
application itself for displaying help, contact information etc.

Rabal could use some feedback so if your interested I would love to hear
what anyone thinks. It resembles hoe in some respects, but it made
to be extensible, so if you have your own directory/file templates you
can write in a plugin to manage them and rabal will pick them up and
incorporate them into the application.
* If I may make a suggestion... I think the API would be nicer if you
did without the Spawnable namespace. Just Launchy::Browser would be
much nicer.

I'll think about it.
Nice work!
T.

Thanks!

-jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top