Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-10-15 12:41:28

jt1122
Member
Registered: 2021-03-26
Posts: 245

Run a script on logout/restart

Hi,

How do I run a script on logout/restart?.

I saw some threads on using a wrapper from circa 2018.

Is there now a dedicated  file to edit?.

Thanks

Offline

#2 2022-10-15 13:33:32

StJimmy
Member
From: De Lage Landen
Registered: 2022-06-27
Posts: 7

Re: Run a script on logout/restart

If you add a new Autostart item under Settings --> Session and Startup --> tab "Autostart Applications", you can specify at which time you want it to run--this includes logout and restart, among others.


Nanos gigantum humeris insidentes.

Offline

#3 2022-10-15 15:37:08

jt1122
Member
Registered: 2021-03-26
Posts: 245

Re: Run a script on logout/restart

Thanks.

I'm familiar with the autostart folder, but where do scripts which run on logout go?.

Cheers

Offline

#4 2022-10-16 08:50:10

jt1122
Member
Registered: 2021-03-26
Posts: 245

Re: Run a script on logout/restart

OK, I've found that adding

RunHook=<value>

to the associated file in ~/.config/autostart would do the trick, where <value> the events and values are:
login 0, logout 1, shutdown 2, restart 3, suspend 4, hibernate 5, hybrid sleep 6, switch user 7.

Offline

#5 2022-10-16 09:52:52

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Run a script on logout/restart

You can also do this via the dialog at Settings Manager > Session and Startup > Autostart Applications. For each entry, click on the Trigger column and you will get a dropdown to set the RunHook values.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2022-10-16 09:55:12

jt1122
Member
Registered: 2021-03-26
Posts: 245

Re: Run a script on logout/restart

Thanks.

Is it possible to have multiple hooks, e.g. a script should run on logout + shutdown + restart?.

Or does this require separate entries?.

Offline

#7 2022-10-16 14:00:25

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Run a script on logout/restart

Answered in the other thread you posted to. At this time no, but it would be a good enhancement to the code if we could have something like a "session exit" entry. Perhaps you could open an enhancement request.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#8 2022-10-16 14:03:31

jt1122
Member
Registered: 2021-03-26
Posts: 245

Re: Run a script on logout/restart

Thanks.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 536.02 KiB (Peak: 536.87 KiB) ]