add instantruntimedir
# try to obtain a temp dir unique to the user, to enable
# instantOS xsessions for concurrent users on the same machine
-if [ -z "${XDG_RUNTIME_DIR}" ]; then
- RTD=/tmp/${UID}/instantos
-else
- RTD=${XDG_RUNTIME_DIR}/instantos
-fi
-[[ -d "${RTD}" ]] || mkdir -p "${RTD}"
+RTD="$(instantruntimedir)"
+RTD="${RTD:/tmp/instantos}"
-echo $$ >${RTD}/instantosrunning
+echo $$ >"${RTD}"/instantosrunning
# just in case, some systems might not do this
cd
@@ -34,18 +30,18 @@ fi
source ~/.instantsession
# loop so crashing instantwm doesn't end the x session
-while [ -e ${RTD}/instantosrunning ]; do
+while [ -e "${RTD}"/instantosrunning ]; do
# allow changing wm on the fly
- if [ -e ${RTD}/wmoverride ]; then
- if command -v "$(cat ${RTD}/wmoverride)" &>/dev/null; then
+ if [ -e "${RTD}"/wmoverride ]; then
+ if command -v "$(cat "${RTD}"/wmoverride)" &>/dev/null; then
"$(cat ${RTD}/wmoverride)" 2>~/.instantos.log &
WMPID="$!"
- echo "$WMPID" >${RTD}/wmpid
+ echo "$WMPID" >"${RTD}"/wmpid
while kill -0 "$WMPID"; do
sleep 1
done
fi
- rm ${RTD}/wmoverride
+ rm "${RTD}"/wmoverride
else
# Log stderror or stdout to a file
if ! [ -e .local/share ]; then
