You are not logged in.

#1 2014-05-27 19:27:40

the_isz
Member
Registered: 2009-04-14
Posts: 280

LightDM: How to stop non-graphical applications on session logout?

Hi all,

I'm currently moving from XDM to LightDM and have a hard time figuring out how to clean up after myself when my session ends.

Here's the problem:

  • I start two non-graphical applications in ~/.xprofile

    • offlineimap

    • ssh-agent

  • I want to cleanly kill these when my graphical session ends

What would be the best way to achieve this?

What I tried until now:

  • Add ~/.xlogout which does the cleanup

  • Create /etc/lightdm/Xsession-mine which calls /etc/lightdm/Xsession and then ~/.xlogout

  • Modify /etc/lightdm/lightdm.conf to use /etc/lightdm/Xsession-mine as session wrapper

Result: ~/.xlogout doesn't seem to be called, probably due to exec in Xsession

History:

With XDM I would start my window manager in the foreground (without exec) in ~/.xinitrc and when it returns call my cleanup code.

Thanks in advance for all help and suggestions!

Timo

Offline

#2 2014-05-27 19:35:44

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: LightDM: How to stop non-graphical applications on session logout?

Haven't used lightdm in a long time... does it have a PostLogout function similar to lxdm?
https://wiki.archlinux.org/index.php/Lxdm#Configuration


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2014-05-27 19:52:49

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: LightDM: How to stop non-graphical applications on session logout?

Hi graysky,

graysky wrote:

Haven't used lightdm in a long time... does it have a PostLogout function similar to lxdm?
https://wiki.archlinux.org/index.php/Lxdm#Configuration

it does have something alike:

# session-cleanup-script = Script to run when quitting a user session (runs as root)

However, as the documentation states, this script is run as root, so I can't clean up on a per-user basis (or can I?).

Kind regards,

Timo

Offline

#4 2014-05-27 20:01:12

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: LightDM: How to stop non-graphical applications on session logout?

Not sure... is using lxdm out of the question?  It has this ability via that config file.  If you cannot, perhaps others can help you.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2014-05-27 20:09:46

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: LightDM: How to stop non-graphical applications on session logout?

Hey again,

actually, your first answer got me thinking. I wrote a little script to run as the session-cleanup-script and printed both $(whoami) and $USER. $(whoami) always yields "root", but $USER is either the user currently logging out (yay!) or empty (if I restart lightdm via systemctl).

So I'll just let root run ~/.Xlogout (if it exists) as the user logging out (or nothing if $USER is empty). I think that'll do for my use case.

Thanks for your input!

Kind regards,

Timo

Offline

Board footer

Powered by FluxBB