Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-02-05 10:22:49

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

How does trigger on suspend work in Session and startup?

Will the associated program set in Application autostart tab be run before suspending, when resuming or on both? Should the program take some arguments? I couldn't make it work in Xubuntu 20.04 running Xfce 14.4.

Offline

#2 2022-02-05 11:42:38

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

Re: How does trigger on suspend work in Session and startup?

It is run when the option is selected. So for example, when you click on "shutdown" (and optionally confirm), then the runhook (trigger) for "shutdown" is processed.

I couldn't make it work in Xubuntu 20.04 running Xfce 14.4

What exactly are you trying to do? Which program and trigger are you using?


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

#3 2022-02-05 11:51:07

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

Re: How does trigger on suspend work in Session and startup?

If your system is systemd-based and if you want something to run on wake from suspend, you can simply write a shell script and place it in /usr/lib/systemd/system-sleep/. For example, here is one that lock the eject button of my DVD drive (not POSIX-compliant):

#!/bin/bash

if [[ $1 = post ]]; then
        eject -i on
fi

systemd-suspend.service(8) has a brief explanation of the format of these scripts.


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

#4 2022-02-05 17:38:52

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

Re: How does trigger on suspend work in Session and startup?

KBar, don't you want to disable eject pre suspend?

I want to run something as the current user, namely to activate remembered pulseaudio sink that I had to unbind due to a bug. Running as superuser like scripts in /usr/lib/systemd/system-sleep/ does not work for pulseaudio.

Offline

#5 2022-02-06 03:50:54

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

Re: How does trigger on suspend work in Session and startup?

jarnos wrote:

KBar, don't you want to disable eject pre suspend?

No, because then it gets unlocked on wakeup again. I have one startup application and one post-suspend specifically script for it. I put my laptop to suspend a lot and I never use its DVD drive. If I could, I would have blacklisted the sr_mod module altogether but unfortunately it was installed and configured as a builtin on my system.

I want to run something as the current user, namely to activate remembered pulseaudio sink that I had to unbind due to a bug. Running as superuser like scripts in /usr/lib/systemd/system-sleep/ does not work for pulseaudio.

PulseAudio works in weird ways. It's an entire system on its own. Perhaps there is an answer somewhere in pulse-cli-syntax(5)?


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

Board footer

Powered by FluxBB