3 # fix broken $UID on some system...
4 if test "x$UID" = "x"; then
5 if test -x /usr/xpg4/bin/id; then
6 UID=`/usr/xpg4/bin/id -u`;
12 # $XDG_CONFIG_HOME defines the base directory relative to which user specific
13 # configuration files should be stored. If $XDG_CONFIG_HOME is either not set
14 # or empty, a default equal to $HOME/.config should be used.
15 if test "x$XDG_CONFIG_HOME" = "x" ; then
16 XDG_CONFIG_HOME=$HOME/.config
18 [ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
20 # $XDG_CACHE_HOME defines the base directory relative to which user specific
21 # non-essential data files should be stored. If $XDG_CACHE_HOME is either not
22 # set or empty, a default equal to $HOME/.cache should be used.
23 if test "x$XDG_CACHE_HOME" = "x" ; then
24 XDG_CACHE_HOME=$HOME/.cache
26 [ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"
29 # set up XDG user directores. see
30 # http://freedesktop.org/wiki/Software/xdg-user-dirs
31 if type xdg-user-dirs-update >/dev/null 2>&1; then
35 if test -f "$XDG_CONFIG_HOME/user-dirs.dirs"; then
36 . "$XDG_CONFIG_HOME/user-dirs.dirs"
37 # i'm deliberately not 'export'-ing the XDG_ vars, because you shouldn't
38 # rely on the env vars inside apps, since the file could be changed at
39 # any time by the user. this is solely here for migration purposes.
41 # a bit of user dir migration...
42 if test -d "$HOME/Desktop" -a ! -L "$HOME/Desktop" \
43 -a "$XDG_DESKTOP_DIR" \
44 -a "$HOME/Desktop" != "$XDG_DESKTOP_DIR"
46 echo "Migrating $HOME/Desktop to $XDG_DESKTOP_DIR..."
47 test -d "$XDG_DESKTOP_DIR" && rmdir "$XDG_DESKTOP_DIR"
48 mv "$HOME/Desktop" "$XDG_DESKTOP_DIR" || echo "Desktop migration failed" >&2
51 if test -d "$HOME/Templates" -a ! -L "$HOME/Templates" \
52 -a "$XDG_TEMPLATES_DIR" \
53 -a "$HOME/Templates" != "$XDG_TEMPLATES_DIR"
55 echo "Migrating $HOME/Templates to $XDG_TEMPLATES_DIR..."
56 test -d "$XDG_TEMPLATES_DIR" && rmdir "$XDG_TEMPLATES_DIR"
57 mv "$HOME/Templates" "$XDG_TEMPLATES_DIR" || echo "Templates migration failed" >&2
62 # Modify libglade and glade environment variables so that
63 # it will find the files installed by Xfce
64 export LIBGLADE_MODULE_PATH="$LIBGLADE_MODULE_PATH:/usr/lib/libglade/2.0"
65 export GLADE_CATALOG_PATH="$GLADE_CATALOG_PATH:"
66 export GLADE_PIXMAP_PATH="$GLADE_PIXMAP_PATH:"
67 export GLADE_MODULE_PATH="$GLADE_MODULE_PATH:"
70 # Export GTK_PATH so that GTK+ can find the Xfce theme engine
71 export GTK_PATH="$GTK_PATH:/usr/lib/gtk-2.0"
74 # For now, start with an empty list
77 # Has to go prior to merging Xft.xrdb, as its the "Defaults" file
78 test -r "/etc/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES /etc/xdg/xfce4/Xft.xrdb"
79 test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"
81 BASEDIR=$XDG_CONFIG_HOME/xfce4
82 if test -r "$BASEDIR/Xft.xrdb"; then
83 XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
84 elif test -r "$XFCE4HOME/Xft.xrdb"; then
86 cp "$XFCE4HOME/Xft.xrdb" "$BASEDIR"/
87 XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
90 # merge in X cursor settings
91 test -r "$BASEDIR/Xcursor.xrdb" && XRESOURCES="$XRESOURCES $BASEDIR/Xcursor.xrdb"
93 # ~/.Xresources contains overrides to the above
94 test -r "$HOME/.Xresources" && XRESOURCES="$XRESOURCES $HOME/.Xresources"
96 # load all X resources (adds /dev/null to avoid an empty list that would hang the process)
97 cat /dev/null $XRESOURCES | xrdb -nocpp -merge -
100 test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap
102 # Launch xscreensaver (if available), but only as non-root user
103 if test $UID -gt 0 -a -z "$VNCSESSION"; then
104 if test x"`which xscreensaver 2>/dev/null`" != x""; then
105 xscreensaver -no-splash &
106 elif test x"`which gnome-screensaver 2>/dev/null`" != x""; then
111 # Use ssh-agent if installed and not already running. Run it separately
112 # so it populates the environment here, so we can clean it up later.
113 sshagent=`which ssh-agent`
115 if test -z "$SSH_AGENT_PID" -a "$sshagent" -a "x$sshagent" != "xno"; then
120 # Use dbus-launch if installed.
121 if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
122 dbuslaunch=`which dbus-launch`
123 if test x"$dbuslaunch" != x"" -a x"$dbuslaunch" != x"no"; then
124 eval `$dbuslaunch --sh-syntax --exit-with-session`
128 # Run xfce4-session if installed
129 xfcesm=`which xfce4-session`
136 if test $kill_sshagent -eq 1; then
148 # Everything below here ONLY gets executed if you are NOT using xfce4-session
149 # (Xfce's session manager). If you are using the session manager, everything
150 # below is handled by it, and the code below is not executed at all. If you're
151 # not sure if you're using the session manager, type 'ps -e|grep xfce4-session'
152 # in a terminal while Xfce is running.
157 # this is only necessary when running w/o xfce4-session
158 xsetroot -solid black -cursor_name watch
160 # or use old-fashioned startup script otherwise
165 # start up stuff in $XDG_CONFIG_HOME/autostart/, as that looks to be
166 # the new standard. if that directory doesn't exist, try the old
167 # ~/Desktop/Autostart method. we're not going to do any migration here.
168 if test -d "$XDG_CONFIG_HOME/autostart"; then
169 for i in ${XDG_CONFIG_HOME}/autostart/*.desktop; do
170 grep -q -E "^Hidden=true" "$i" && continue
171 if grep -q -E "^OnlyShowIn=" "$i"; then
172 # need to test twice, as lack of the line entirely means we still run it
173 grep -E "^OnlyShowIn=" "$i" | grep -q 'XFCE;' || continue
175 grep -E "^NotShowIn=" "$i" | grep -q 'XFCE;' && continue
178 trycmd=`grep -E "^TryExec=" "$i" | cut -d'=' -f2`
179 if test "$trycmd"; then
180 type "$trycmd" >/dev/null 2>&1 || continue
183 cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
184 if test "$cmd" && type "$cmd" >/dev/null 2>&1; then
188 elif test -d "$HOME/Desktop/Autostart"; then
189 for i in `ls -1 -L ${HOME}/Desktop/Autostart/ 2>/dev/null`; do
190 if test -x $HOME/Desktop/Autostart/$i; then
191 $HOME/Desktop/Autostart/$i &
199 panel=`which xfce4-panel`
206 while test $ret -ne 0; do
207 xmessage -center -file - -timeout 20 -title Error <<EOF
208 A crash occured in the panel
209 Please report this to the xfce4-dev@xfce.org list
210 or on http://bugs.xfce.org
211 Meanwhile the panel will be restarted
214 A crash occured in the panel
215 Please report this to the xfce4-dev@xfce.org list
216 or on http://bugs.xfce.org
217 Meanwhile the panel will be restarted
225 if test $kill_sshagent -eq 1; then
229 xsetroot -bg white -fg red -solid black -cursor_name watch