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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#!/bin/sh
# fix broken $UID on some system...
if test "x$UID" = "x"; then
if test -x /usr/xpg4/bin/id; then
UID=`/usr/xpg4/bin/id -u`;
else
UID=`id -u`;
fi
fi
# set $XDG_MENU_PREFIX to "xfce-" so that "xfce-applications.menu" is picked
# over "applications.menu" in all Xfce applications.
if test "x$XDG_MENU_PREFIX" = "x"; then
XDG_MENU_PREFIX="xfce-"
export XDG_MENU_PREFIX
fi
# set DESKTOP_SESSION so that one can detect easily if an Xfce session is running
if test "x$DESKTOP_SESSION" = "x"; then
DESKTOP_SESSION="xfce"
export DESKTOP_SESSION
fi
# set XDG_CURRENT_DESKTOP so that Qt 5 applications can identify user set Xfce theme
if test "x$XDG_CURRENT_DESKTOP" = "x"; then
XDG_CURRENT_DESKTOP="XFCE"
export XDG_CURRENT_DESKTOP
fi
# $XDG_CONFIG_HOME defines the base directory relative to which user specific
# configuration files should be stored. If $XDG_CONFIG_HOME is either not set
# or empty, a default equal to $HOME/.config should be used.
if test "x$XDG_CONFIG_HOME" = "x" ; then
XDG_CONFIG_HOME=$HOME/.config
export XDG_CONFIG_HOME
fi
[ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
# $XDG_CACHE_HOME defines the base directory relative to which user specific
# non-essential data files should be stored. If $XDG_CACHE_HOME is either not
# set or empty, a default equal to $HOME/.cache should be used.
if test "x$XDG_CACHE_HOME" = "x" ; then
XDG_CACHE_HOME=$HOME/.cache
export XDG_CACHE_HOME
fi
[ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"
# set up XDG user directores. see
# http://freedesktop.org/wiki/Software/xdg-user-dirs
if command -v xdg-user-dirs-update >/dev/null 2>&1; then
xdg-user-dirs-update
fi
if test "x$XFCE4_SESSION_COMPOSITOR" = "x"
then
# For now, start with an empty list
XRESOURCES=""
# Has to go prior to merging Xft.xrdb, as its the "Defaults" file
test -r "@_sysconfdir_@/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES @_sysconfdir_@/xdg/xfce4/Xft.xrdb"
test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"
BASEDIR=$XDG_CONFIG_HOME/xfce4
if test -r "$BASEDIR/Xft.xrdb"; then
XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
elif test -r "$XFCE4HOME/Xft.xrdb"; then
mkdir -p "$BASEDIR"
cp "$XFCE4HOME/Xft.xrdb" "$BASEDIR"/
XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
fi
# merge in X cursor settings
test -r "$BASEDIR/Xcursor.xrdb" && XRESOURCES="$XRESOURCES $BASEDIR/Xcursor.xrdb"
# ~/.Xresources contains overrides to the above
test -r "$HOME/.Xresources" && XRESOURCES="$XRESOURCES $HOME/.Xresources"
# load all X resources (adds /dev/null to avoid an empty list that would hang the process)
cat /dev/null $XRESOURCES | xrdb -merge -
# load local modmap
test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap
fi
# ensure both the DBus session bus and systemd user session (if running) has
# all the env vars it needs to properly populate the environment of child
# processes
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
if command -v systemctl >/dev/null 2>&1 && systemctl --user list-jobs >/dev/null 2>&1; then # user session is running
systemd_arg='--systemd'
fi
dbus-update-activation-environment $systemd_arg \
DESKTOP_SESSION \
XAUTHLOCALHOSTNAME=$XAUTHLOCALHOSTNAME \
XDG_CACHE_HOME \
XDG_CONFIG_DIRS \
XDG_CONFIG_HOME \
XDG_CURRENT_DESKTOP \
XDG_DATA_DIRS \
XDG_DATA_HOME \
XDG_MENU_PREFIX \
XDG_RUNTIME_DIR \
XDG_SEAT \
XDG_SEAT_PATH \
XDG_SESSION_CLASS \
XDG_SESSION_DESKTOP \
XDG_SESSION_ID \
XDG_SESSION_PATH \
XDG_SESSION_TYPE \
XDG_STATE_HOME
fi
# check if we start xfce4-session with ck-launch-session. this is only
# required for starting from a console, not a login manager
if test "x$XFCE4_SESSION_WITH_CK" = "x1"; then
if command -v ck-launch-session >/dev/null 2>&1; then
exec ck-launch-session xfce4-session
else
echo
echo "You have tried to start Xfce with consolekit support, but"
echo "ck-launch-session is not installed."
echo "Aborted startup..."
echo
exit 1
fi
else
# workaround https://github.com/canonical/lightdm/issues/63
if [ -n "$XDG_VTNR" ] && [ -f "/sys/devices/virtual/tty/tty0/active" ]; then
VT_TEST_CNT=1
while true; do
CURRENT_VT=$(cat /sys/devices/virtual/tty/tty0/active)
if [ "$CURRENT_VT" = "tty$XDG_VTNR" ]; then
break
fi
VT_TEST_CNT=$((VT_TEST_CNT + 1))
if [ "$VT_TEST_CNT" -gt 100 ]; then
echo "VT $XDG_VTNR is expected but the switch did not happen in the last second, continuing anyway."
break
fi
sleep 0.01
done
fi
# start xfce4-session normally
exec ${XFCE4_SESSION_COMPOSITOR:-xfce4-session}
fi
# if we got here, then exec failed
exit 1
|