aboutsummaryrefslogtreecommitdiffstats
path: root/s2u.sh
blob: c0e08d71a80f3128ea51977f85dec7125ae3edd7 (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
#!/bin/sh
#---------------------------------------------------------------
# Project         : Mandrakelinux
# Module          : s2u
# File            : s2u.sh
# Version         : $Id$
# Author          : Frederic Lepied
# Created On      : Sat Jul 31 01:03:37 2004
# Purpose         : launch the dbus client attaching it to an
#             exisiting dbus session or launching a new one to
#             attache itself to.
#---------------------------------------------------------------

CURR_DISPLAY=`LC_ALL=C xdpyinfo | grep 'display' | awk '{print $4}'`

f="/tmp/dbus-$USER-xsession$CURR_DISPLAY"

vars() {
    if [ -f "$f" -a -O "$f" ]; then
	. "$f"
    fi
}

vars

if [ -z "$DBUS_SESSION_BUS_PID" -o ! -d "/proc/$DBUS_SESSION_BUS_PID" ]; then
    F=`mktemp /tmp/dbus.XXXXXX`
    chmod 600 $F
    dbus-launch --sh-syntax --exit-with-session > $F
    rm -f "$f"
    mv -f $F "$f"
    vars
fi

exec s2u --daemon=yes

# s2u.sh ends here