File xinitrc of Package scrotwm
#!/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
# $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
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
fi
[ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"
# set up XDG user directores. see
# http://freedesktop.org/wiki/Software/xdg-user-dirs
if type xdg-user-dirs-update >/dev/null 2>&1; then
xdg-user-dirs-update
fi
if test -f "$XDG_CONFIG_HOME/user-dirs.dirs"; then
. "$XDG_CONFIG_HOME/user-dirs.dirs"
# i'm deliberately not 'export'-ing the XDG_ vars, because you shouldn't
# rely on the env vars inside apps, since the file could be changed at
# any time by the user. this is solely here for migration purposes.
# a bit of user dir migration...
if test -d "$HOME/Desktop" -a ! -L "$HOME/Desktop" \
-a "$XDG_DESKTOP_DIR" \
-a "$HOME/Desktop" != "$XDG_DESKTOP_DIR"
then
echo "Migrating $HOME/Desktop to $XDG_DESKTOP_DIR..."
test -d "$XDG_DESKTOP_DIR" && rmdir "$XDG_DESKTOP_DIR"
mv "$HOME/Desktop" "$XDG_DESKTOP_DIR" || echo "Desktop migration failed" >&2
fi
if test -d "$HOME/Templates" -a ! -L "$HOME/Templates" \
-a "$XDG_TEMPLATES_DIR" \
-a "$HOME/Templates" != "$XDG_TEMPLATES_DIR"
then
echo "Migrating $HOME/Templates to $XDG_TEMPLATES_DIR..."
test -d "$XDG_TEMPLATES_DIR" && rmdir "$XDG_TEMPLATES_DIR"
mv "$HOME/Templates" "$XDG_TEMPLATES_DIR" || echo "Templates migration failed" >&2
fi
fi
# For now, start with an empty list
XRESOURCES=""
test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"
BASEDIR=$XDG_CONFIG_HOME/scrotwm
if test -r "$BASEDIR/Xft.xrdb"; then
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
# Launch xscreensaver (if available), but only as non-root user
if test $UID -gt 0 -a -z "$VNCSESSION"; then
if test x"`which xscreensaver 2>/dev/null`" != x""; then
xscreensaver -no-splash &
elif test x"`which gnome-screensaver 2>/dev/null`" != x""; then
gnome-screensaver &
fi
fi
# Use ssh-agent if installed and not already running. Run it separately
# so it populates the environment here, so we can clean it up later.
sshagent=`type -p ssh-agent ||:`
kill_sshagent=0
if test -z "$SSH_AGENT_PID" -a "$sshagent" -a -n "$sshagent"; then
eval `$sshagent -s`
kill_sshagent=1
fi
# Use dbus-launch if installed.
if test -n "$DBUS_SESSION_BUS_ADDRESS"; then
dbuslaunch=`type -p dbus-launch ||:`
if test -n "$dbuslaunch"; then
eval `$dbuslaunch --sh-syntax --exit-with-session`
fi
fi
xsetroot -solid black -cursor_name watch
# start up stuff in $XDG_CONFIG_HOME/autostart/, as that looks to be
# the new standard. if that directory doesn't exist, try the old
# ~/Desktop/Autostart method. we're not going to do any migration here.
if test -d "$XDG_CONFIG_HOME/autostart"; then
for i in ${XDG_CONFIG_HOME}/autostart/*.desktop; do
grep -q -E "^Hidden=true" "$i" && continue
if grep -q -E "^OnlyShowIn=" "$i"; then
# need to test twice, as lack of the line entirely means we still run it
grep -E "^OnlyShowIn=" "$i" | grep -qw 'scrotwm' || continue
fi
grep -E "^NotShowIn=" "$i" | grep -qw 'scrotwm' && continue
# check for TryExec
trycmd=`grep -E "^TryExec=" "$i" | cut -d'=' -f2`
if test "$trycmd"; then
type -p "$trycmd" || continue
fi
cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
if test "$cmd" && type -p "$cmd"; then
$cmd &
fi
done
elif test -d "$HOME/Desktop/Autostart"; then
for i in `ls -1 -L ${HOME}/Desktop/Autostart/ 2>/dev/null`; do
if test -x $HOME/Desktop/Autostart/$i; then
$HOME/Desktop/Autostart/$i &
fi
done
fi
if test $kill_sshagent -eq 1; then
eval `$sshagent -k`
fi
xsetroot -bg white -fg red -solid black -cursor_name watch