Xorg window manager auto run custom start/stop scripts
mouse 477 · person cloud · link
Last update
2018-09-06
2018
09-06
«window/display manager autostart
xfce, lightdm»

After reading Debian Xsession docs you can use this trick to automatically execute your scripts before starting your window manager and also after terminating it.

  • create a ~/.xsessionrc in where you update the PATH env var:
1
export PATH="$HOME/bin:$PATH"
  • create a wrapper with the same name of your window manager launcher, for example I use XFCE:
1
2
3
4
5
6
# $HOME/bin/xfce4-session
[ -f $HOME/bin/autostart-login.sh  ] && $HOME/bin/autostart-login.sh

/usr/bin/xfce4-session # run the real window manager

[ -f $HOME/bin/autostart-logout.sh  ] && $HOME/bin/autostart-logout.sh
  • login through your display manager (kdm, gdm, lightdm, ...) choosing the default session (Debian X session)

Using LightDM you can specify custom scripts on its settings in /etc/lightdm/lightdm.conf:

1
2
3
4
5
session-wrapper        # wrapper script to run session with
session-setup-script   # run as root on session start
session-cleanup-script # run as root on session exit
session-setup-script   # run as the user on session start
session-cleanup-script # run as the user on session exit