]> git.madduck.net Git - etc/xsession.git/blob - .xsession

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

store temp xsession errors file on cleanup
[etc/xsession.git] / .xsession
1 #!/bin/zsh --login
2
3 RUNDIR="/run/user/$(id -u)"
4 mkdir -m700 -p "$RUNDIR"
5 NEW_ERRFILE=$RUNDIR/xsession-errors
6 if [ -f "$ERRFILE" ]; then
7   mv "$ERRFILE" $NEW_ERRFILE
8 elif [ -L /tmp/xsession-$LOGNAME ]; then
9   mv $(readlink -f /tmp/xsession-$LOGNAME) $NEW_ERRFILE
10   rm /tmp/xsession-$LOGNAME
11 fi
12 chmod 600 $NEW_ERRFILE
13 ln -sf $NEW_ERRFILE $HOME/.xsession-errors
14
15 TRAPS="0 1 2 3 4 5 6 7 8 10 11 12 13 14 15"
16 cleanup() {
17   rm -f $HOME/.xsession-errors
18   mv $NEW_ERRFILE $HOME/.xsession-errors
19   trap - $TRAPS
20 }
21 trap cleanup $TRAPS
22
23 exec >>$NEW_ERRFILE 2>&1
24
25 set -u
26
27 while :; do
28   for script in $(run-parts --list $HOME/.xsession.d); do
29     echo I: sourcing ${script:t}... >&2
30     . $script
31     echo I: done sourcing ${script:t}... >&2
32   done
33
34   [ -e $HOME/.xsession-exit ] && break
35
36   echo "I: restarting xsession (touch $HOME/.xsession-exit to exit)..." >&2
37 done
38
39 rm -f $HOME/.xsession-exit
40
41 exit 0