xfce changeS
[~bandali/configs] / xfce4 / .config / xfce4 / xinitrc
CommitLineData
54086bb0
AB
1#!/bin/sh
2
3# fix broken $UID on some system...
4if test "x$UID" = "x"; then
5 if test -x /usr/xpg4/bin/id; then
6 UID=`/usr/xpg4/bin/id -u`;
7 else
8 UID=`id -u`;
9 fi
10fi
11
12# set $XDG_MENU_PREFIX to "xfce-" so that "xfce-applications.menu" is picked
13# over "applications.menu" in all Xfce applications.
14if test "x$XDG_MENU_PREFIX" = "x"; then
15 XDG_MENU_PREFIX="xfce-"
16 export XDG_MENU_PREFIX
17fi
18
19# set DESKTOP_SESSION so that one can detect easily if an Xfce session is running
20if test "x$DESKTOP_SESSION" = "x"; then
21 DESKTOP_SESSION="xfce"
22 export DESKTOP_SESSION
23fi
24
25# set XDG_CURRENT_DESKTOP so that Qt 5 applications can identify user set Xfce theme
26if test "x$XDG_CURRENT_DESKTOP" = "x"; then
27 XDG_CURRENT_DESKTOP="XFCE"
28 export XDG_CURRENT_DESKTOP
29fi
30
31# $XDG_CONFIG_HOME defines the base directory relative to which user specific
32# configuration files should be stored. If $XDG_CONFIG_HOME is either not set
33# or empty, a default equal to $HOME/.config should be used.
34if test "x$XDG_CONFIG_HOME" = "x" ; then
35 XDG_CONFIG_HOME=$HOME/.config
36fi
37[ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
38
39# $XDG_CACHE_HOME defines the base directory relative to which user specific
40# non-essential data files should be stored. If $XDG_CACHE_HOME is either not
41# set or empty, a default equal to $HOME/.cache should be used.
42if test "x$XDG_CACHE_HOME" = "x" ; then
43 XDG_CACHE_HOME=$HOME/.cache
44fi
45[ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"
46
47# set up XDG user directores. see
48# http://freedesktop.org/wiki/Software/xdg-user-dirs
49if which xdg-user-dirs-update >/dev/null 2>&1; then
50 xdg-user-dirs-update
51fi
52
53# Modify libglade and glade environment variables so that
54# it will find the files installed by Xfce
55GLADE_CATALOG_PATH="$GLADE_CATALOG_PATH:"
56GLADE_PIXMAP_PATH="$GLADE_PIXMAP_PATH:"
57GLADE_MODULE_PATH="$GLADE_MODULE_PATH:"
58export GLADE_CATALOG_PATH
59export GLADE_PIXMAP_PATH
60export GLADE_MODULE_PATH
61
62# For now, start with an empty list
63XRESOURCES=""
64
65# Has to go prior to merging Xft.xrdb, as its the "Defaults" file
66test -r "/etc/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES /etc/xdg/xfce4/Xft.xrdb"
67test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"
68
69BASEDIR=$XDG_CONFIG_HOME/xfce4
70if test -r "$BASEDIR/Xft.xrdb"; then
71 XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
72elif test -r "$XFCE4HOME/Xft.xrdb"; then
73 mkdir -p "$BASEDIR"
74 cp "$XFCE4HOME/Xft.xrdb" "$BASEDIR"/
75 XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
76fi
77
78# merge in X cursor settings
79test -r "$BASEDIR/Xcursor.xrdb" && XRESOURCES="$XRESOURCES $BASEDIR/Xcursor.xrdb"
80
81# ~/.Xresources contains overrides to the above
82test -r "$HOME/.Xresources" && XRESOURCES="$XRESOURCES $HOME/.Xresources"
83
84# load all X resources (adds /dev/null to avoid an empty list that would hang the process)
85cat /dev/null $XRESOURCES | xrdb -nocpp -merge -
86
87# load local modmap
88test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap
89
90# run xfce4-session if installed
91if which xfce4-session >/dev/null 2>&1; then
92
93 # check if we start xfce4-session with ck-launch-session. this is only
94 # required for starting from a console, not a login manager
95 if test "x$XFCE4_SESSION_WITH_CK" = "x1"; then
96 if which ck-launch-session >/dev/null 2>&1; then
97 ck-launch-session xfce4-session
98 else
99 echo
100 echo "You have tried to start Xfce with consolekit support, but"
101 echo "ck-launch-session is not installed."
102 echo "Aborted startup..."
103 echo
104
105 exit 1
106 fi
107 else
108 # start xfce4-session normally
109 xfce4-session
110 fi
111
112 exit 0
113fi
114
115##################
116# IMPORTANT NOTE #
117##################
118
119# Everything below here ONLY gets executed if you are NOT using xfce4-session
120# (Xfce's session manager). If you are using the session manager, everything
121# below is handled by it, and the code below is not executed at all. If you're
122# not sure if you're using the session manager, type 'ps -e|grep xfce4-session'
123# in a terminal while Xfce is running.
124
125##################
126
127# Use dbus-launch if installed.
128if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
129 if which dbus-launch >/dev/null 2>&1; then
130 eval `dbus-launch --sh-syntax --exit-with-session`
131 # some older versions of dbus don't export the var properly
132 export DBUS_SESSION_BUS_ADDRESS
133 else
134 echo "Could not find dbus-launch; Xfce will not work properly" >&2
135 fi
136fi
137
138# this is only necessary when running w/o xfce4-session
139xsetroot -solid black -cursor_name watch
140
141# or use old-fashioned startup script otherwise
142
143xfsettingsd &
144xfwm4 --daemon
145
146# start up stuff in $XDG_CONFIG_HOME/autostart/
147if test -d "$XDG_CONFIG_HOME/autostart"; then
148 for i in ${XDG_CONFIG_HOME}/autostart/*.desktop; do
149 grep -q -E "^Hidden=true" "$i" && continue
150 if grep -q -E "^OnlyShowIn=" "$i"; then
151 # need to test twice, as lack of the line entirely means we still run it
152 grep -E "^OnlyShowIn=" "$i" | grep -q 'XFCE;' || continue
153 fi
154 grep -E "^NotShowIn=" "$i" | grep -q 'XFCE;' && continue
155
156 # check for TryExec
157 trycmd=`grep -E "^TryExec=" "$i" | cut -d'=' -f2`
158 if test "$trycmd"; then
159 which "$trycmd" >/dev/null 2>&1 || continue
160 fi
161
162 cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
163 if test "$cmd" && which "$cmd" >/dev/null 2>&1; then
164 $cmd &
165 fi
166 done
167fi
168
169xfdesktop&
170orage &
171
172panel=`which xfce4-panel`
173case "x$panel" in
174 x|xno*)
175 ;;
176 *)
177 $panel
178 ret=$?
179 while test $ret -ne 0; do
180 xmessage -center -file - -timeout 20 -title Error <<EOF
181A crash occured in the panel
182Please report this to the xfce4-dev@xfce.org list
183or on http://bugs.xfce.org
184Meanwhile the panel will be restarted
185EOF
186 cat >&2 <<EOF
187A crash occured in the panel
188Please report this to the xfce4-dev@xfce.org list
189or on http://bugs.xfce.org
190Meanwhile the panel will be restarted
191EOF
192 $panel
193 ret=$?
194 done
195 ;;
196esac
197
198xsetroot -bg white -fg red -solid black -cursor_name watch