I don't really like this, but I wanted DM to show list of users instead of simple prompt. Arch wiki suggests just to killall --user $USER which would also kill all your background processes they may be running (torrent, screen, etc).
Enough words - here goes the script:
$ cat /etc/lxdm/PostLogout #!/bin/sh # # Note: this is a sample and will not be run as is. current_windows=`xlsclients -al | grep Window | cut -d' ' -f2 | sed -e 's/:$//'` for wid in $current_windows do pid=`xprop -id ${wid} _NET_WM_PID | awk -F ' = ' '{ print $2 }'` wmname=`xprop -id ${wid} WM_CLASS | cut -d= -f2 | cut -d, -f2 | sed -e 's/[ "]//g'` if [ "p${pid}" != "p" ] then echo "Killing ${wmname} (${pid})" kill ${pid} else echo "No PID found for ${wmname}" fi done # for some reason PID for conky cannot be determined killall --user $USER conkyIt requires xlsclients and xprop. Some apps (like conky) are special case and they don't show their PID in X11 properties of a window, so they are killed separately.