# better logging
append instead of overwrite, record restarts and crashes
@@ -33,6 +33,19 @@ fi
[ -e ~/.instantsession ] && source ~/.instantsession
+ILOGFILE="$HOME/.local/share/instantos.log"
+
+if iconf -i debug; then
+ export INSTANTDEBUG="true"
+fi
+
+if [ -z "$INSTANTDEBUG" ]; then
+ if [ -e "$ILOGFILE" ] && [ "$(du -sm "$ILOGFILE" | grep -o '^[0-9]*')" -gt 20 ]; then
+ echo "log file has gotten out of hand, clearing logs"
+ echo "start of log file" >"$ILOGFILE"
+ fi
+fi
+
# loop so crashing instantwm doesn't end the x session
while [ -e "${RTD}"/instantosrunning ]; do
# allow changing wm on the fly
@@ -54,10 +67,13 @@ while [ -e "${RTD}"/instantosrunning ]; do
export XDG_CURRENT_DESKTOP="instantwm"
- if iconf -i debug; then
- instantwm &>~/.local/share/instantos.log
+ if [ -n "$INSTANTDEBUG" ]; then
+ instantwm &>>~/.local/share/instantos.log
+ export WMEXITCODE="$?"
else
- instantwm 2>~/.local/share/instantos.log
+ instantwm 2>>~/.local/share/instantos.log
+ export WMEXITCODE="$?"
fi
fi
+ echo "$(date): window manager was restarted or crashed" >>~/.local/share/instantos.log
done
