[xubuntu-users] How to get process to start with GUI login and exit on GUI logout?
Chris Green
cl at isbd.net
Mon Jan 31 23:17:07 UTC 2022
On Mon, Jan 31, 2022 at 04:57:30PM -0600, Knute Johnson wrote:
>
>
> On 1/31/22 14:50, Chris Green wrote:
> > On Mon, Jan 31, 2022 at 02:22:15PM -0600, Knute Johnson wrote:
> > >
> > >
> > > 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.
> > >
> > That's exactly how my background script is already run, and it doesn't
> > stop when I log out.
> >
> >
> > > Pretty good explanation here:
> > > https://wiki.archlinux.org/title/Desktop_entries
> > >
> > Doesn't tell me how to stop the process on exit! :-)
> >
>
> So exactly how are you starting your "process" now? What sort of program is
> it? Is it being run by you or ?
>
It's currently being started by a .desktop file in
~/.config/autostart, the standard way created by an entry in 'Session
and Startup'. It's just a bash shell script.
> You are probably going to have to start it with systemd.
>
I don't think that helps does it, systemd doesn't have the ability to
start a program when an X session is started, nor can it stop a
program when X exits.
--
Chris Green
More information about the xubuntu-users
mailing list