<div dir="auto"><div>Thanks both of you.</div><div dir="auto">Points me in right direction .</div><div dir="auto"><br></div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, 5 Feb 2024, 23:07 James Dutton via GLLUG, <<a href="mailto:gllug@mailman.lug.org.uk" target="_blank" rel="noreferrer">gllug@mailman.lug.org.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On ubuntu put an extra script in /lib/systemd/system-sleep<br>
<br>
Look at other files already in there for a guide as to how to write them.<br>
e.g. create a new file in /lib/systemd/system-sleep:<br>
<br>
#!/bin/sh<br>
<br>
PATH=/sbin:/usr/sbin:/bin:/usr/bin<br>
<br>
case "$1" in<br>
pre) whoami >>/tmp/tt3<br>
exit 0<br>
;;<br>
post) whoami >>/tmp/tt3<br>
exit 0<br>
;;<br>
*) exit 1<br>
;;<br>
esac<br>
<br>
<br>
<br>
The problem with doing something with amixer is that when you run<br>
amixer, you need to be your user, but the script is run as root so it<br>
won't work.<br>
You could run in under sudo for your user name, but it will not work<br>
if you are logged in as any other user at suspend time.<br>
<br>
<br>
<br>
On Mon, 5 Feb 2024 at 22:30, Carles Pina i Estany via GLLUG<br>
<<a href="mailto:gllug@mailman.lug.org.uk" rel="noreferrer noreferrer" target="_blank">gllug@mailman.lug.org.uk</a>> wrote:<br>
><br>
><br>
> Hi,<br>
><br>
> On 05 Feb 2024 at 17:53:16, Andrew Black via GLLUG wrote:<br>
> > I used to have a script on my WIndoze PC that switched the speaker to 0 on<br>
> > resume from suspend or hibernate. It saved me embarrassment of playing<br>
> > bombastic organ music in a quiet library!<br>
> ><br>
> > I wonder if I could do the same of Ubuntu. It is in two parts<br>
> ><br>
> > - Detecting when you suspend or resume (I am not bothered which!)<br>
> > - Changing the volume level to 0 (or close to 0).<br>
><br>
><br>
> I use something similar (with desktop shortcuts) to change the volume<br>
> and toggle mute or not in Debian.<br>
><br>
> This sets it to 0, to me (I think that depends of the audio<br>
> configuration will work or not for you):<br>
><br>
> amixer set Master 0%<br>
><br>
> Regarding the suspend and resume: I know that there are scripts that are<br>
> executed, but I don't know which ones right now (and might be<br>
> different on Debian or Ubuntu). Hopefully someone else will know!<br>
><br>
> Cheers,<br>
><br>
> --<br>
> Carles Pina i Estany<br>
> <a href="https://carles.pina.cat" rel="noreferrer noreferrer noreferrer" target="_blank">https://carles.pina.cat</a><br>
> --<br>
> GLLUG mailing list<br>
> <a href="mailto:GLLUG@mailman.lug.org.uk" rel="noreferrer noreferrer" target="_blank">GLLUG@mailman.lug.org.uk</a><br>
> <a href="https://mailman.lug.org.uk/mailman/listinfo/gllug" rel="noreferrer noreferrer noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/gllug</a><br>
<br>
-- <br>
GLLUG mailing list<br>
<a href="mailto:GLLUG@mailman.lug.org.uk" rel="noreferrer noreferrer" target="_blank">GLLUG@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/gllug" rel="noreferrer noreferrer noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/gllug</a><br>
</blockquote></div></div></div>