Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-09-17 23:13:23

jarnos
Member
From: Finland
Registered: 2009-03-22
Posts: 50
Website

How to run a command after resume from suspend automatically?

I want the command to be run as the regular user of the session, not as root.

Offline

#2 2022-09-18 04:06:21

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: How to run a command after resume from suspend automatically?

See.

Try changing the ownership of the script afterwards.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#3 2022-09-18 07:49:00

jarnos
Member
From: Finland
Registered: 2009-03-22
Posts: 50
Website

Re: How to run a command after resume from suspend automatically?

I don't see what changing ownership of the script would help. Besides, if there are many users, I need to run the action as the user that I resume to. I do not know that when a script in /usr/lib/systemd/system-sleep/ is running.

Offline

#4 2022-09-18 08:15:53

KBar
Moderator
Registered: 2021-11-05
Posts: 689

Re: How to run a command after resume from suspend automatically?

See systemd-suspend.service(8).


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#5 2022-09-18 08:41:57

jarnos
Member
From: Finland
Registered: 2009-03-22
Posts: 50
Website

Re: How to run a command after resume from suspend automatically?

Does Xfce session know that it resumed from suspend?

Offline

#6 2022-09-18 09:49:32

jarnos
Member
From: Finland
Registered: 2009-03-22
Posts: 50
Website

Re: How to run a command after resume from suspend automatically?

I managed to reset the default sink in a script in  /usr/lib/systemd/system-sleep/.

I used commands prefixes like

sudo -u USERNAME XDG_RUNTIME_DIR=/run/user/$(id -u USERNAME)

to get/set the desired sink name. I guess I would have to do it for every user that is logged on, to make it work as expected.

Offline

Board footer

Powered by FluxBB