[GLLUG] Sound off resume resume from suspend.

Andrew Black andrewdblack at googlemail.com
Wed Feb 7 23:47:04 UTC 2024


Thanks both of you.
Points me in right direction .



On Mon, 5 Feb 2024, 23:07 James Dutton via GLLUG, <gllug at mailman.lug.org.uk>
wrote:

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


More information about the GLLUG mailing list