Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute a script when xfce session ends

Tags:

linux

xfce

Is it possible to run a script/command when the xfce session stops ?

like image 310
Denis R. Avatar asked Sep 28 '11 07:09

Denis R.


1 Answers

See http://mail.xfce.org/pipermail/xfce/2012-November/031694.html - There, Erik Habicht suggested creating a wrapper script in /usr/local/bin/xfce4-session (or another dir that precedes the dir where xfce4-session is installed, /usr/bin in your PATH). This way, you do not have to change /usr/bin/X11/xfce4-session, so it can be updated independently.

#!/bin/bash
# Add your own pre-session logic here
/usr/bin/xfce4-session
# Add your own logout logic here

then

$ chmod +x /usr/local/bin/xfce4-session

It's not perfect (depends on PATH order) but may be more palatable.

(Note: I promoted my comment to an answer.)

like image 159
djb Avatar answered Sep 18 '22 18:09

djb