You are not logged in.
Pages: 1
Is there a way to hook up a script so that it runs when the session exits? Not necessarily via XFCE, something similar to $HOME/.xsessionrc would do (but I don't believe it exists).
I think GDM has a postsession, but I'd rather stick to lightdm.
Offline
Take a look at session-cleanup-script in lightdm.conf
Offline
Thanks! That was a good hint, but that script is documented as "runs as root", and I'd like to run mine as part of the session.
I ended up removing "exec" from /etc/X11/Xsession.d/99x11-common_start. This allows more scripts to be added after 99x11* in /etc/X11/Xsession.d/ (e.g. 99zzz-user-*). On Debian, `dpkg-divert` can be used to make this survive upgrades.
Of course, this requires admin rights, and it's not a solution for everyone. On systemd systems, one can add systemd --user scripts.
Offline
GDM has a postsession
This script is runs as root too.
What do you want to do whithout root privilege?
You can do su -l "SUSER" in this script.
Offline
This script is runs as root too.
What do you want to do whithout root privilege?
You can do su -l "SUSER" in this script.
Yeah, I could su (or sudo)... but it wouldn't be part of the session, and I'm not sure what the implications are (presumably no --user dbus / systemd-related commands, which I'm not currently using anyway, but I might want to).
Also, I don't think you can cleanly find out post-session what the logged in user was.
For the moment, I'm just saving back some cached files from /tmp/... to ~/
Last edited by frmald (2021-03-08 18:31:51)
Offline
Try to add an item in the Application Autostart tab of Session and Startup dialog. You can choose there when to trigger the command.
Offline
Pages: 1
[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 532.42 KiB (Peak: 533.05 KiB) ]