Q1: quand tu lances TB en temps normal, il te demande un profil ?
Non, je le lance en cliquant sur un bouton qui appelle à /usr/bin/thunderbird
Le mozilla-launcher:
#!/bin/bash
#
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-src/mozilla-launcher/mozilla-launcher,v 1.16 2004
/08/05 22:07:10 agriffis Exp $
# Set MOZILLA_NEWTYPE to "window" in your environment if you prefer
# new windows instead of new tabs
newtype=${MOZILLA_NEWTYPE:-"tab"}
# Make sure necessary progs are in the PATH
PATH=/usr/bin:/bin:/usr/X11R6/bin:$PATH
main() {
local args mozargs urls u i
local candidates retval=0 remote_supports_dash_a zero=${0##*/}
# Determine if we're called as firefox or mozilla and set up
# variables appropriately
which_browser || exit 1 # note: modifies $zero
# Parse the command-line and set args, mozargs and urls
parse_cmdline "$@" || exit 1
# Make sure we'll get at least an empty window/tab
# when nothing else is specified on the cmdline.
if [[ $# -eq 0 ]]; then
if [[ $zero == ?hunderbird ]]; then
mozargs=-mail
else
urls=('')
fi
fi
# Set the candidates array with find_running
find_running
# Handle some special args. We want to handle these ourselves so
# that we can find the right window on the screen to target.
set -- "${mozargs[@]}"
while [[ $# -gt 0 ]]; do
case 1ドル in
-mail) try_running 'xfeDoCommand(openInbox)' ;;
-compose) try_running 'xfeDoCommand(composeMessage)' ;;
-remote) try_running "2ドル" && shift ;;
esac
[[ $? -eq 0 ]] && { shift; continue; }
# Error path: try_running failed, so prepend remaining mozargs to
# args and drop through to call the browser binary
args=("$@" "${args[@]}")
break
done
# If there's no running browser, or we've got args, start an
# instance.
if [[ ${#args[@]} -gt 0 ]] || ! try_running 'ping()'; then
# Assume the first url should just be tacked on the end.
try_start "${args[@]}" ${urls:+"${urls[0]}"}
set -- "${urls[@]}"; shift; urls=("$@") # shift off the first url
candidates=$DISPLAY
args=()
# Handle case of multiple URLs by waiting for browser to map to
# the screen so that it can be found by $remote below
if [[ ${#urls[@]} -gt 0 ]]; then
if [[ -x /usr/bin/xtoolwait ]]; then
xtoolwait sleep 10 # hope it hasn't mapped yet
else
sleep 1
for ((i = 0; i < 40; i = i + 1)); do
try_running 'ping()' && break || sleep 0.25
done
fi
fi
fi
# Handle multiple URLs by looping over the xremote call
for u in "${urls[@]}"; do
if [[ $u == mailto:* ]]; then
try_running "mailto(${u#mailto:})" || retval=$?
else
try_running "openURL($u,new-$newtype)" || retval=$?
fi
done
# Will only wait here if browser was started by this script
if ! wait; then
retval=$?
echo "${mozbin##*/} exited with non-zero status ($?)" >&2
fi
exit $retval
}
which_browser() {
# Support mozilla, mozilla-bin, firefox, firefox-bin, thunderbird,
# thunderbird-bin!
# This case statement does the setup for source-based browsers and
# just drops through for binary-based browsers.
case $zero in
*fox)
export MOZILLA_FIVE_HOME="/usr/lib/MozillaFirefox"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/firefox-bin
grepfor=Firefox-bin
prefs=$HOME/.phoenix
;;
*mozilla)
export MOZILLA_FIVE_HOME="/usr/lib/mozilla"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/mozilla-bin
grepfor=Mozilla-bin
prefs=$HOME/.mozilla
;;
*thunderbird)
export MOZILLA_FIVE_HOME="/usr/lib/MozillaThunderbird"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/thunderbird-bin
grepfor=Thunderbird-bin
prefs=$HOME/.thunderbird
;;
*-bin)
unset mozbin # just in case...
;; # but don't do anything yet
*)
echo "0ドル: unknown browser" >&2
return 1
;;
esac
# Attempt to use -bin version if source version isn't available
if [[ -n $mozbin && ! -f $mozbin ]]; then
unset mozbin # it's bogus anyway
zero=${zero}-bin
fi
case $zero in
*fox-bin)
export MOZILLA_FIVE_HOME="/opt/firefox"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/firefox-bin
grepfor=Firefox-bin
prefs=$HOME/.phoenix
;;
*mozilla-bin)
export MOZILLA_FIVE_HOME="/opt/mozilla"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/mozilla-bin
grepfor=Mozilla-bin
prefs=$HOME/.mozilla
;;
*thunderbird-bin)
export MOZILLA_FIVE_HOME="/opt/thunderbird"
remote=$MOZILLA_FIVE_HOME/mozilla-xremote-client
mozbin=$MOZILLA_FIVE_HOME/thunderbird-bin
grepfor=Thunderbird-bin
prefs=$HOME/.thunderbird
;;
esac
# Make sure we got something
if [[ -z $mozbin || ! -f $mozbin ]]; then
echo "0ドル: can't find the browser :-(" >&2
return 1
fi
# Trim -bin from ${zero} for the sake of xremote -a programname
zero=${zero%-bin}
# Workaround thunderbird needing -a Thunderbird
# See http://bugzilla.mozilla.org/show_bug.cgi?id=247754(...)
if [[ $zero == thunderbird ]]; then
fgrep -q '"0.7"' ${MOZILLA_FIVE_HOME}/defaults/pref/thunderbird.js \
&& zero=Thunderbird
fi
# Read the preferences directory from appreg
# so that we can delete XUL.mfasl since it causes so many problems.
# (This code works but is commented out since I'm not sure that we
# actually need it)
#if [[ -n $prefs && -r $prefs/appreg ]]; then
# prefs=$(strings $prefs/appreg 2>/dev/null | sed -n '/^directory$/{n;p;q}')
#fi
# Set LD_LIBRARY_PATH (also set in /etc/env.d/10*)
export LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$MOZILLA_FIVE_HOME/plugins${LD_LIBRA
RY_PATH:+:$LD_LIBRARY_PATH}
return 0
}
# parse_cmdline: set args, mozargs and urls, which are dynamically
# scoped in main()
parse_cmdline() {
# Validate the args and extract the urls
args=() # general arguments
mozargs=() # arguments that we handle specifically
urls=() # urls to open
while [[ $# -ne 0 ]] ; do
if [[ 1ドル == -* ]] ; then
case "${1#-}" in
height|width|CreateProfile|P|UILocale|contentLocale|edit|chrome)
args=("${args[@]}" "1ドル" "2ドル")
shift 2 ;;
mail|compose)
mozargs=("${mozargs[@]}" "1ドル")
shift 1 ;;
remote)
mozargs=("${mozargs[@]}" "1ドル" "2ドル")
shift 2 ;;
*)
args=("${args[@]}" "1ドル")
shift 1 ;;
esac
else
if [[ 1ドル == *://*/* ]]; then
urls=("${urls[@]}" "1ドル")
elif [[ 1ドル == *://* ]]; then
# as of mozilla_1.7_rc1 the url checking changed for xremote
# calls... now three slashes are required for urls, otherwise we
# get the following error from xremote:
# Error: Failed to send command: 509 internal error
urls=("${urls[@]}" "1ドル/")
elif [[ 1ドル != *://* && 1ドル != /* && -e 1ドル ]]; then
# relative path to a file, transform to absolute path
urls=("${urls[@]}" "file://$PWD/1ドル")
elif [[ 1ドル != *:* && 1ドル == *@* ]]; then
# looks like an email address, prefix with mailto: so we can
# recognize it later.
urls=("${urls[@]}" "mailto:1ドル")
else
# no idea what this is! just add it to urls and hope it works
urls=("${urls[@]}" "1ドル")
fi
shift
fi
done
return 0
}
# set_logname: make sure LOGNAME is set
set_logname() {
: ${LOGNAME:=$USER}
: ${LOGNAME:=$(whoami)}
export LOGNAME
}
# fake_user: fake user string on browser windows that should be found
# by $remote. This is a hack, but on the other hand, anything other
# than patching the xremote source would be a hack. This prevents
# xremote from mixing up mozilla and firefox windows.
fake_user() {
local id retval=1
set_logname
# Find browser windows with a _MOZILLA_USER property and fake it
for id in $(xwininfo -root -tree | awk -v gf="$grepfor" '0ドル~gf{print 1ドル}'); do
if xprop -notype -id $id | grep -Fqx "_MOZILLA_USER = \"$LOGNAME\""; then
xprop -id $id -f _MOZILLA_USER 8s -set _MOZILLA_USER "${zero}-$LOGNAME"
retval=0
fi
done
return $retval
}
# unfake_user: remove the hackery done by fake_user
unfake_user() {
local id
set_logname
# Find browser windows with a fake _MOZILLA_USER and fix it
for id in $(xwininfo -root -tree | awk -v gf="$grepfor" '0ドル~gf{print 1ドル}'); do
xprop -notype -id $id | grep -Fqx "_MOZILLA_USER = \"${zero}-$LOGNAME\"" \
&& xprop -id $id -f _MOZILLA_USER 8s -set _MOZILLA_USER "$LOGNAME"
done
}
# find_running: sets the candidates array
find_running() {
local screens s
# Try to start in an existing session; check all screens
# with priority on the current screen
screens=("$DISPLAY"
$(xdpyinfo | awk '
/^name of display:/ {
disp = substr($NF, 0, match($NF, /\.[^.]*$/)-1)
}
/^number of screens:/ {
for (i = 0; i < $NF; i++) {
this = sprintf("%s.%d", disp, i)
if (this != ENVIRON["DISPLAY"])
print this
}
}')
)
# We used to check displays with xwininfo here but that isn't
# necessary with the advent of fake_user and/or -a programname.
# Instead just test for a running program if we're on a local
# display.
if [[ $DISPLAY != :* ]] || killall -0 ${mozbin##*/} &>/dev/null; then
candidates=("${screens[@]}")
else
candidates=()
fi
}
# try_running: try to use an existing browser to run a command
try_running() {
local s retval=2 # default == can't find an instance
# Check for newer xremote which supports -a programname
# which thankfully obviates fake_user
if [[ -z $remote_supports_dash_a ]]; then
if $remote 2>&1 | grep -Fq '[-a '; then
remote_supports_dash_a=true
else
remote_supports_dash_a=false
fi
fi
# Try mozilla-xremote-client on each candidate screen.
# Only use mozilla-xremote-client if we have no other args (which
# must be passed to the browser binary).
if [[ ${#candidates[@]} > 0 ]]; then
if $remote_supports_dash_a || [[ -n $MOZ_FORCE_FAKE_USER || \
( $candidates == :* && -z $MOZ_NO_FAKE_USER ) ]]
then
# Attempt to find a target browser using either -a or fake_user
for s in "${candidates[@]}"; do
if $remote_supports_dash_a; then
DISPLAY=$s $remote -a ${zero} "$@"
retval=$?
elif DISPLAY=$s fake_user; then
LOGNAME="${zero}-$LOGNAME" DISPLAY=$s $remote "$@"
retval=$?
DISPLAY=$s unfake_user
fi
if [[ $retval -eq 0 ]]; then
candidates=("$s") # for future calls
return 0
fi
done
else
# fake_user stuff takes prohibitively long on a remote
# display, so I guess this has the potential to exhibit the
# mozilla/firefox mixups for the 1% of users that are running
# both simultaneously from a remote machine.
for s in "${candidates[@]}"; do
DISPLAY=$s $remote "$@"
retval=$?
if [[ $retval -eq 0 ]]; then
candidates=("$s") # for future calls
return 0
fi
done
fi
fi
# Might as well do this error interpretation here
case $retval in
1) echo "Unable to connect to X server" >&2 ;;
2) echo "No running windows found" >&2 ;;
3) echo "Browser doesn't understand command" >&2 ;;
*) echo "Unknown error $retval from mozilla-xremote-client" >&2 ;;
esac
return $retval
}
# try_start: attempt to start a browser
try_start() {
# Delete XUL cache since it causes so many problems
# (depends on commented code in which_browser)
#[[ -f $prefs/XUL.mfasl ]] && rm -f $prefs/XUL.mfasl
$mozbin "$@" &
}
# Call the main sub, which is defined at the top of this script
main "$@"
# vim:expandtab sw=2:
/usr/lib/MozillaThunderbird/thunderbird
#!/bin/sh
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/(...)
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
## $Id: mozilla.in,v 1.2.6.1 2004年07月24日 23:58:06 bryner%brianryner.com Exp $
##
## Usage:
##
## $ mozilla [args]
##
## This script is meant to run the mozilla-bin binary from either
## mozilla/xpfe/bootstrap or mozilla/dist/bin.
##
## The script will setup all the environment voodoo needed to make
## the mozilla-bin binary to work.
##
moz_pis_startstop_scripts()
{
MOZ_USER_DIR=".thunderbird"
# MOZ_PIS_ is the name space for "Mozilla Plugable Init Scripts"
# These variables and there meaning are specified in
# mozilla/xpfe/bootstrap/init.d/README
MOZ_PIS_API=2
MOZ_PIS_MOZBINDIR="${dist_bin}"
MOZ_PIS_SESSION_PID="$$"
MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
case "${1}" in
"start")
for curr_pis in "${dist_bin}/init.d"/S* "${HOME}/${MOZ_USER_DIR}/init.d"/S* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "start" ;;
esac
fi
done
;;
"stop")
for curr_pis in "${HOME}/${MOZ_USER_DIR}/init.d"/K* "${dist_bin}/init.d"/K* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "stop" ;;
esac
fi
done
;;
*)
echo 1>&2 "0ドル: Internal error in moz_pis_startstop_scripts."
exit 1
;;
esac
}
#uncomment for debugging
#set -x
moz_libdir=/usr/lib/thunderbird-0.8
MRE_HOME=/usr/lib/mre/mre-0.8
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
found=0
progname="0ドル"
curdir=`dirname "$progname"`
progbase=`basename "$progname"`
run_moz="$curdir/run-mozilla.sh"
if test -x "$run_moz"; then
dist_bin="$curdir"
found=1
else
here=`/bin/pwd`
while [ -h "$progname" ]; do
bn=`basename "$progname"`
cd `dirname "$progname"`
progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
if [ ! -x "$progname" ]; then
break
fi
curdir=`dirname "$progname"`
run_moz="$curdir/run-mozilla.sh"
if [ -x "$run_moz" ]; then
cd "$curdir"
dist_bin=`pwd`
found=1
break
fi
done
cd "$here"
fi
if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin="$moz_libdir"
else
echo "Cannot find mozilla runtime directory. Exiting."
exit 1
fi
fi
script_args=""
moreargs=""
debugging=0
MOZILLA_BIN="${progbase}-bin"
# The following is to check for a currently running instance.
# This is taken almost verbatim from the Mozilla RPM package's launch script.
MOZ_CLIENT_PROGRAM="$dist_bin/mozilla-xremote-client"
check_running() {
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" 'ping()' 2>/dev/null >/dev/null
RETURN_VAL=$?
if [ $RETURN_VAL -eq 0 ]; then
echo 1
return 1
else
echo 0
return 0
fi
}
if [ "$OSTYPE" = "beos" ]; then
mimeset -F "$MOZILLA_BIN"
fi
ALREADY_RUNNING=`check_running`
################################################################ Parse Arguments
# If there's a command line argument but it doesn't begin with a -
# it's probably a url. Try to send it to a running instance.
_USE_EXIST=0
_NEW_WINDOW=
_optOne="1ドル"
case "${_optOne}" in
-*)
;;
*)
_USE_EXIST=1
;;
esac
_optOthers=
_optLast=
for i in "$@"; do
_optLast="${i}"
done #last arg
for i in "$@"; do
[ $i = ${_optLast} ] && break
_optOthers="${_optOthers} ${i}"
done #others arg
#???: needs check if othersopt begin with -* ?
if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
# Last argument seems to be a local file/directory
# Check, if it is absolutely specified (ie. /home/foo/file vs. ./file)
# If it is just "relatively" (./file) specified, make it absolutely
[ `expr "${_optLast}" : '/.*'` -eq 0 ] && _optLast="file://`pwd`/${_optLast}"
elif [ `expr "${_optLast}" : '.*:/.*'` -gt 0 -o -n "${_optOthers}" ]; then #???? like before...
_NEW_WINDOW=1
fi
################################################################ Parse Arguments
########################################################################### Main
if [ $ALREADY_RUNNING -eq 1 ]; then
# There's an instance already running. Use it.
# Any command line args passed in?
if [ $# -gt 0 ]; then
# There were "some" command line args.
if [ ${_USE_EXIST} -eq 1 ]; then
# We should use an existing instance, as _USE_EXIST=$_USE_EXIST=-1
_open_type="window"
#_open_type="tab"
_remote_cmd="openURL(${_optLast} , new-${_open_type})"
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "${_remote_cmd}"
unset _remote_cmd _open_type
exit $?
fi
else
# No command line args. Open new window/tab
#exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "xfeDoCommand(openBrowser)"
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "xfeDoCommand(openInbox)"
exit $?
fi
fi
# Default action - no running instance or _USE_EXIST (${_USE_EXIST}) ! -eq 1
########################################################################### Main
while [ $# -gt 0 ]
do
case "1ドル" in
-p | --pure | -pure)
MOZILLA_BIN="${MOZILLA_BIN}.pure"
shift
;;
-g | --debug)
script_args="$script_args -g"
debugging=1
shift
;;
-d | --debugger)
script_args="$script_args -d 2ドル"
shift 2
;;
*)
moreargs="$moreargs \"1ドル\""
shift 1
;;
esac
done
export MRE_HOME
eval "set -- $moreargs"
## Start addon scripts
moz_pis_startstop_scripts "start"
if [ $debugging = 1 ]
then
echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
fi
"$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
exitcode=$?
## Stop addon scripts
moz_pis_startstop_scripts "stop"
exit $exitcode
# EOF.
[^] # Re: Trouver une instance Thunderbird...
Posté par Djax . En réponse au message Liens mailto: dans Firefox vers Thunderbird. Évalué à 1.