2

I find it annoying when I forget to stop videos before closing my laptop and then having sound played when opening it in public.

I tried to add a script to /lib/systemd/system-sleep:

#!/bin/bash

amixer -q -D pulse sset Master mute

echo 2 >> /home/user/test

The script seems to be called when suspending as new lines are being appended to the "test" file (twice - which might indicate that the script also runs on resume - can someone confirm this assumption?)

Either the sound system re-enables itself automatically or something else is wrong. But the amixer command executed manually works fine.

Any ideas?

  • I have tested your script and I have the same results. It executes twice - I did echo $(date '+%d/%m/%Y %H:%M:%S') and I have in the log file the time of suspend and the time of resume also. Testing manually the script on terminal - it do mute the sound, but after suspend/resume the sound is not muted. My guess was that the os automaticaly enables the sound on resume but if I mute the sound before going into suspend, after resume it is muted also. Adding a sleep 1 function do not help... – Bo rislav Dec 24 '19 at 21:37
  • Yes that was what I found out, too :( – Christian Jan 4 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.