#!/bin/sh
# $Id: firefox,v 1.12 2018/03/19 21:45:37 friedman Exp $

prog=`run-next -p "$0"`
ffox() { exec run-misc.sh "$prog" "$@"; }

case $* in *-ProfileManager* ) ffox -no-remote "$@" ;; esac

version=`ffox --version | sed -e 's/.* \([0-9][0-9]*\)\..*/\1/'`
if [ $version -ge 57 ];
then profile=ffoxq
else profile=firefox
fi

numscreens=`xdpyinfo | sed -n -e '/^number of screens: */s///p'`
case $numscreens$DISPLAY in
    2:*.0 ) ffox -P $profile     "$@" ;;
    2:*.1 ) ffox -P $profile.2nd "$@" ;;
    * ) ffox "$@" ;;
esac

# eof
