Huh. Is it the ping and the vnc stuff (clueless about that). To make moz work with a file manager that passes weird arguments, I do this
if [ -L ~/.mozilla/default/5kivd9lf.slt/lock ]; then
/home/j/bin/mozilla/mozilla -remote "openurl(file://$1/$2)"
When mozilla runs it creates a lock file (or link, rather), so I check for that. I'm not interested in new windows or anything - I just want stuff starting an instance or opening in a running instance. Tink's ping method's neat, but maybe this will do? Just find where moz is dropping the lock file and check for it?