#!/usr/bin/perl -T # # Ok, gnome/mozilla don't play nice together sometimes. # In the users' gnome preferences the "Preferred Application" for http # is mozilla (at least in redhat). So gnome passes a "%s" URL string to # mozilla when you click on a hyperlink in an application. # This is fine if mozilla isn't running but if it is then the # browser gets confused as to which profile to use. # Put this script into /usr/bin (or wherever you want it) and then # configure "Preferred Applications->Web Browser" under Preferences # to use this script instead of the "mozilla" command. Remember to put # the "%s" after the path to moz-url.pl. # Harry Hoffman use strict; use warnings; # If mozilla isn't in one of these directories than add the path to it's # location. $ENV{PATH} = "/usr/bin:/bin:/usr/local/mozilla"; my $url = $ARGV[0]; my $defurl = "http://www.google.com"; unless (defined $url) { $url = $defurl; } if ( $url =~ /^(http:\/\/.{1,500}|ftp:\/\/.{1,500}|file:\/\/\/.{1,500})/ ) { $url = $1; } else { $url = $defurl; } my $running = `mozilla -remote "ping()" 2>&1`; chomp($running); my $norun = "No running window found."; if ( $running eq $norun ) { exec "mozilla $url &"; } else { exec "mozilla -remote \"openurl($url,new-tab)\" &"; }