home/.xinitrc

35 lines
775 B
Plaintext
Raw Normal View History

#!/bin/sh
#
# Salt's .xinitrc
# Copyright (C) 2018 salt <salt@lap-th-e560-0>
#
# Distributed under terms of the MIT license.
#
die() {
if [ -z "$1" ]; then
echo "Failed to start session" >&2
else
echo "Failed to start session: $1" >&2
fi
exit 1
}
2018-11-13 21:24:07 -06:00
# Set up our session target
2018-12-05 15:10:34 -06:00
if [ -x "$HOME/.dsk/dsk" ]; then
2018-11-13 21:24:07 -06:00
export DSK_HOME="$HOME/.dsk"
export STARTUP="$DSK_HOME/dsk"
2019-01-16 16:29:04 -06:00
elif [ -x "${XDG_CACHE_DIR:-$HOME/.local/share}/dsk/dsk" ]; then
export STARTUP="${XDG_CACHE_DIR:-$HOME/.local/share}/dsk/dsk"
2018-11-13 21:24:07 -06:00
fi
2018-11-26 03:36:59 -06:00
[ -z "$STARTUP" ] && die "No session target available"
2018-11-13 21:24:07 -06:00
2018-11-26 03:36:59 -06:00
# Execute our target
# Yes shellcheck, the rest of the code is an error handler
# shellcheck disable=2093
exec "$STARTUP"
2018-11-13 21:24:07 -06:00
# If we get here, we haven't exec'd a target and must die
die "Miscellaneous error"