blob: 3f8c2f6ecbc1efe7e9a7be3bbe4d506b878324de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/bin/bash
#
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-www/mozilla-firebird/files/MozillaFirebird,v 1.2 2004/01/14 20:50:49 agriffis Exp $
# Set to "window" if you prefer new Firebird windows instead of new tabs
newtype=${MOZILLA_NEWTYPE:-"tab"}
# Point this to your Firebird installation if not using the default
export MOZILLA_FIVE_HOME="/usr/lib/MozillaFirebird"
fbpath=${MOZILLA_FIVE_HOME}
# Sanity check
if [[ -z $DISPLAY ]]; then
echo "DISPLAY is unset!" >&2
exit 1
fi
# Validate the args and extract the url
url=''
declare -a args=($@)
while [[ $# -ne 0 ]] ; do
if [[ $1 == -* ]] ; then
case ${1#-} in
height|width|CreateProfile|P|UILocale|contentLocale|remote|edit|chrome)
shift 2 ;;
*)
shift 1 ;;
esac
else
if [[ -n $url ]] ; then
echo "Usage error: more than one URL given" >&2
exit 255
else
url=$1
shift 1
if [[ $url != *:* ]] ; then
url=http://$url
fi
fi
fi
done
# Try to start in an existing session; check all screens
declare -a screens=(
$(xdpyinfo | awk '
/^name of display:/ {
disp = substr($NF, 0, index($NF, ".")-1)
}
/^number of screens:/ {
for (i = 0; i < $NF; i++) printf("%s.%d\n", disp, i)
}')
)
for s in $DISPLAY "${screens[@]}"; do
DISPLAY=${s} ${fbpath}/mozilla-xremote-client "openURL($url, new-$newtype)" \
&& exit 0
done
retval=$?
if [[ $retval -eq 2 ]] ; then
# No running windows found, so start a new instance
${fbpath}/MozillaFirebird "${args[@]}"
retval=$?
elif [[ $retval -eq 1 ]] ; then
echo "Unable to connect to X server" >&2
elif [[ $retval -eq 3 ]] ; then
echo "Unable to send command to running Mozilla Firebird instance" >&2
else
echo "Unknown error $retval from mozilla-xremote-client" >&2
fi
exit $retval
# vim:expandtab sw=2:
|