xinitrc: Use 'exec' and comment logoff cleaning issue

master
Pierre Neidhardt 2016-06-22 11:16:48 +02:00
parent f9c57990dc
commit f91890a06d
1 changed files with 16 additions and 5 deletions

View File

@ -1,17 +1,28 @@
#!/bin/sh
## Run site init scripts. Usually not necessary.
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
## Source environment config.
[ -f ~/.xprofile ] && . ~/.xprofile
## Launch session
## Note: we do not 'exec' as we want to clean the session on exit.
if [ $# -eq 1 ] && command -v $1 >/dev/null 2>&1; then
$1
exec $1
else
awesome
exec awesome
fi
## TODO: This is not needed since all forked processes will be killed anyway
## when 'exec' is not called. But why?
## TODO: When the session is terminated, some forked processes must be closed
## manually. This can automated by setting a shell 'trap' in .profile when
## logged from a TTY. The trick does not work from an X login manager. This file
## could be the place where to clean everything, but it will not be parsed by
## some login managers. Beside, systemd sessions may sigkill all user apps on
## logoff, preventing a clean termination.
# command -v sessionclean >/dev/null 2>&1 && sessionclean