#!/bin/sh
#
# /etc/X11/wdm/Xreset
#
# This script is run as root after any X session ends.

# Use common X11 Xreset framework if available
if [ -x /etc/X11/Xreset ]; then
    /etc/X11/Xreset
fi

# Remove the utmp entry for the session
if grep -qs '^use-sessreg' /etc/X11/wdm/wdm.options \
    && which sessreg >/dev/null 2>&1; then
    sessreg -d -l "$DISPLAY" -u /var/run/utmp -x /etc/X11/wdm/Xservers "$USER"
fi

# This must be done here as opposed to in the Xsetup scripts as
# they are run after wdm has initialized its session menu, so
# any changes made there won't be reflected in the current menu
if grep -qs '^auto-update-wmlist' /etc/X11/wdm/wdm.options; then
    update_wdm_wmlist
fi

exit 0
