[xubuntu-users] How to get process to start with GUI login and exit on GUI logout?

Knute Johnson groups at 585ranch.com
Mon Jan 31 20:22:15 UTC 2022



On 1/31/22 06:30, Chris Green wrote:
> I have a background process that I want to start when I log into my
> xfce session and I want it to exit when I log out of the session.
> 
> I thought that adding it to the list in the Session & Startup settings
> would do this but the process doesn't exit when I log out from the
> xfce session.  If I log out and then log back in to xfce I get
> multiple copies of my process.
> 
> So, is there an easy/correct way to do this or do I need to add code
> to my background process to manage things?
> 

Use a .desktop file.  See: 
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

This is the simple way to start/stop a program when your desktop runs. 
You put the file in your ~/.config/autostart directory.  When you log in 
it runs and when you log out it stops.

Pretty good explanation here: 
https://wiki.archlinux.org/title/Desktop_entries

-- 

Knute Johnson



More information about the xubuntu-users mailing list