Mozilla Launch Utility

Couannette couannette at free.fr
Fri Oct 3 14:23:29 GMT 2003


My own script :-D

Niki Guldbrand wrote:
> Hi All.
> 
> I have been playing a little with this script and now i can hit any link
> in evolution or other gnome apps, and if no mozilla is running then it
> starts a new one, if a mozilla is running it opens the url in a new tab.
> 
> To set this up go to "Applications -> Desktop Preferences -> Advanced ->
> Preferred Applicaions" (Also see the screenshot menu-1.jpg).
> Then in that app choose the "Web Browser" tab, then select "Custom Web
> Browser:" and enter the path to the script and adding a space plus "%s"
> after that, then choose "Close" and your ready (See screenshot
> prefapp-1.jpeg)
> 
> Hope some of you will find this useful.
> 
> 
> Niki
> 
> PS: Remember to make the script executable ;-)
> 
> On Thu, 2003-08-28 at 00:29, r0dzilla wrote:
> 
>>I got tired of hitting the mozilla icon only to have it ask me to  
>>create another profile because I had mozilla running on another virtual 
>>desktop or something...
>>
>>So, I made a script that makes use of the -remote option of mozilla.
>>
>>It checks to see if mozilla is running.  If it is, a new mozilla window 
>>will be launched, if it's not, mozilla will be started as usual.
>>
>>Save the attachment to wherever you like, give it execute permissions 
>>(chmod +x launchmoz.sh), and modify your desktop icon to launch the 
>>script instead of mozilla.
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> #!/bin/sh
> #
> # checkmoz
> #
> # a script to launch a mozilla window if mozilla is already running
> #
> # copyleft 2003, Rodney M. Brown <rodzilla at r0dzilla.net>
> #
> # Minor modification by Niki Guldbrand <niki at lunar-linux.org>,
> #   to make it work with gnomes "prefered aplications"
> #
> # this script is distributed under the GPL v2 license
> #
> 
> $(mozilla -remote "ping()")
> 
> case "$?" in
>      0 )  $(mozilla -remote "openurl($1,new-tab)") & ;;
>      * )  $(mozilla $1) & ;;
> esac
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> lunar mailing list
> lunar at lunar-linux.org
> http://dbguin.lunar-linux.org/mailman/listinfo/lunar

-------------- next part --------------
#!/bin/sh
#
# CopyLeft (c) 2003 Michel Briand <couannette at free.fr>
#
# Usage: 
#	mozremote [-newtab] <url>
#	mozremote -mail
#	mozremote mailto:<email>
#	mozremote -remote <remote command>
#
# <url> only supports  http and file for now but feel free to add some ;-)
#
#

mozD() {
	exec mozilla "$1"
}

mozR() {
	exec mozilla -remote "$1"
}

test_mozilla() {
	mozilla -remote "ping()"
	if [ ! $? = 0 ]; then
		M=mozD
		mailM="-mail"
		webM=
		urlM=
		urlM2=
	else
		M=mozR
		mailM="xfeDoCommand(openInbox)"
		webM="xfeDoCommand(openBrowser)"
		urlM="openurl("
		urlM2=",new-window)"
	fi
}

test_mozilla

if [ "$1" == "-newtab" ]; then
    urlM2=",new-tab)"
    shift
fi

if [ "$1" == "-remote" ]; then
    "$M" $@
fi

if [ "$1" == "-mail" ]; then
    "$M" "$mailM"
fi

proto=$(echo $1 | cut -d ':' -f 1)
case $proto in
    http|file)
	"$M" "$urlM""$1""$urlM2" 
	;;
    mailto) 
	addr=$(echo $1 | cut -d ':' -f 2)
	"$M" mailto\($addr\)
	;;
    *)
	"$M" "$urlM$urlM2" 
	;;
esac



More information about the lunar mailing list