Skip to main content
Topic: Run script after/before suspending/hibernating (Read 300 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Run script after/before suspending/hibernating

After suspending/hibernating audio streams ignore the volume set so they are played at max volume.
Since I set the hardware at max volume and I lower sink settings.
To fix it I can simply change the sink volume.
I use pipewire.

And it could be useful to run some script anyway.
Can you run them when locking too?


 

Re: Run script after/before suspending/hibernating

Reply #2
Looks good for system actions.
I tried:
Code: [Select]
#!/bin/sh

case "$1" in
    pre)
    /usr/bin/notify-send "pre"
        touch /path/to/my/home/post-executed
    ;;
    post)
        /usr/bin/pamixer -u -d 5
        /usr/bin/notify-send "post"
        touch /path/to/my/home/post-executed
        ;;
esac

If I launch it manually it works but when suspending no file is created.

Is elogind supposed to be able to do things in my home?

I made the file /etc/modprobe.d/alsa.conf with this content:
Code: [Select]
options snd_hda_intel index=1
And now after suspending/hibernating audio streams is fine.
I tried a little let's see if it is fixed properly.