How do I set the output volume of a device to 0 on startup?

As title states, I just need to find the best way to set the volume to 0 when the device boots up, before the gamescope startup movie plays.
15 Replies
Cilantro Limewire
I love this idea, playing with it rn
duck9r
duck9rOP5d ago
I would absolutely adore if someone could find a way, because trying to make heads or tails of the pipewire/wireplumber documentation is messing me up bad I tried systemd user service (which worked when I ran it myself but did not run on it's own at boot), I tried putting it in a pipewire config, I tried setting props on the device...none of it stopped pipewire from just grabbing whatever the previous volume was and restoring it
Cilantro Limewire
you have to wait for gamescope to set the default, then mute it right after I think ok heres what I've got, gonna see about making a ujust toggle to automate but help me validate, only tried on my ally x
mkdir -p ~/.local/bin
nano ~/.local/bin/mute-audio.sh
mkdir -p ~/.local/bin
nano ~/.local/bin/mute-audio.sh
put this in the .sh
#!/usr/bin/env bash

echo "$(date) - Waiting for default sink..." >> /tmp/mute.log
for i in {1..20}; do
DEFAULT=$(pactl get-default-sink 2>/dev/null)
echo "$(date) - pactl get-default-sink output: $DEFAULT" >> /tmp/mute.log
if [[ -n "$DEFAULT" && "$DEFAULT" != @DEFAULT_SINK@ ]]; then
echo "$(date) - Sink: $DEFAULT found. Muting..." >> /tmp/mute.log
pactl set-sink-volume "$DEFAULT" 0%
pactl set-sink-mute "$DEFAULT" 1
echo "$(date) - Done." >> /tmp/mute.log
exit 0
fi
sleep 0.5
done
echo "$(date) - No usable sink found after 10s. Skipping mute." >> /tmp/mute.log
#!/usr/bin/env bash

echo "$(date) - Waiting for default sink..." >> /tmp/mute.log
for i in {1..20}; do
DEFAULT=$(pactl get-default-sink 2>/dev/null)
echo "$(date) - pactl get-default-sink output: $DEFAULT" >> /tmp/mute.log
if [[ -n "$DEFAULT" && "$DEFAULT" != @DEFAULT_SINK@ ]]; then
echo "$(date) - Sink: $DEFAULT found. Muting..." >> /tmp/mute.log
pactl set-sink-volume "$DEFAULT" 0%
pactl set-sink-mute "$DEFAULT" 1
echo "$(date) - Done." >> /tmp/mute.log
exit 0
fi
sleep 0.5
done
echo "$(date) - No usable sink found after 10s. Skipping mute." >> /tmp/mute.log
make exec chmod +x ~/.local/bin/mute-audio.sh make a service mkdir -p ~/.config/systemd/user nano ~/.config/systemd/user/mute-audio.service with:
Description=Mute audio after PipeWire is ready
After=pipewire.service
Requires=pipewire.service

[Service]
Type=oneshot
ExecStart=home/your-username/.local/bin/mute-audio.sh

[Install]
WantedBy=default.target
Description=Mute audio after PipeWire is ready
After=pipewire.service
Requires=pipewire.service

[Service]
Type=oneshot
ExecStart=home/your-username/.local/bin/mute-audio.sh

[Install]
WantedBy=default.target
enable and reload that hoe systemctl --user daemon-reexec systemctl --user daemon-reload systemctl --user enable mute-audio.service then you can systemctl reboot and check the tmp log at cat /tmp/mute.log to see whats up should see something like
Wed Jun 4 03:44:29 PM EDT 2025 - Waiting for default sink...
Wed Jun 4 03:44:29 PM EDT 2025 - pactl get-default-sink output: @DEFAULT_SINK@
Wed Jun 4 03:44:30 PM EDT 2025 - pactl get-default-sink output: alsa_output.pci-0000_64_00.6.analog-stereo
Wed Jun 4 03:44:30 PM EDT 2025 - Sink: alsa_output.pci-0000_64_00.6.analog-stereo found. Muting...
Wed Jun 4 03:44:30 PM EDT 2025 - Done.
Wed Jun 4 03:44:29 PM EDT 2025 - Waiting for default sink...
Wed Jun 4 03:44:29 PM EDT 2025 - pactl get-default-sink output: @DEFAULT_SINK@
Wed Jun 4 03:44:30 PM EDT 2025 - pactl get-default-sink output: alsa_output.pci-0000_64_00.6.analog-stereo
Wed Jun 4 03:44:30 PM EDT 2025 - Sink: alsa_output.pci-0000_64_00.6.analog-stereo found. Muting...
Wed Jun 4 03:44:30 PM EDT 2025 - Done.
duck9r
duck9rOP5d ago
Trying this now on my Ally (non-x), just need to fire up sshd and copy it in this is all pretty close to what I tried with the service before, but I just had a one-liner for amixer sset Master 0% (and a couple other one-liners I tried) you could be right that we need to wait. Someone else suggested I try a sleep on the service to delay it but I was out of juice by then and just didn't have any more in me I assume /home/bazzite is just meant to be my home directory for whatever account?
Cilantro Limewire
oh shoot yeah should fix that
Cilantro Limewire
but lmk how this manual one works for you
duck9r
duck9rOP5d ago
works when I start it, rebooting now to test running at boot It did mute the output, but did not change the volume. checking mute.log now pactl set-sink-volume "$DEFAULT" 0% does work when I run it myself though, in both desktop and gamescope
ducky@DuckAlly:~$ cat /tmp/mute.log
Wed Jun 4 01:35:03 PM MST 2025 - Waiting for default sink...
Wed Jun 4 01:35:03 PM MST 2025 - pactl get-default-sink output: ROG Ally
Wed Jun 4 01:35:03 PM MST 2025 - Sink: ROG Ally found. Muting...
Wed Jun 4 01:35:04 PM MST 2025 - Done.
ducky@DuckAlly:~$ cat /tmp/mute.log
Wed Jun 4 01:35:03 PM MST 2025 - Waiting for default sink...
Wed Jun 4 01:35:03 PM MST 2025 - pactl get-default-sink output: ROG Ally
Wed Jun 4 01:35:03 PM MST 2025 - Sink: ROG Ally found. Muting...
Wed Jun 4 01:35:04 PM MST 2025 - Done.
Cilantro Limewire
isn't that the desired behavior? muted but volume state preserved?
duck9r
duck9rOP5d ago
for me at least, the desire is that the volume be at 0, I'm not necessarily concerned with it being muted when I run mute-audio.sh myself, it sets the volume to 0 (from the line pactl set-sink-volume "$DEFAULT" 0%) and mutes, which would still be totally acceptable for my usecase but when I reboot and let the service do it, it behaves differently, preserving the volume level but still muting
Cilantro Limewire
weird, can you reboot and get me that log just for the boot action not you doing it manual?
duck9r
duck9rOP5d ago
that is the log for the boot action
CheckYourFax
CheckYourFax4d ago
What is it you're trying to achieve? That the boot video doesn't play audio? Because that can solved by just replacing the boot video with one that doesn't contain an audio track which can easily be made into an ujust with a very simple script I would be very much happy with a simple ujust for doing that, but we gotta make sure it doesn't interfere with the current method of replacing the boot video
Cilantro Limewire
I personally do want a mute or set to 0 on boot and/or wake from suspend toggle though, like muOS on anbernic devices for example. Would be nice for cases where I had it cranked but now I wake from suspend at night in bed and it’s still cranked Fair warning when I was playing around with variants of the boot script and service above I somehow got Steam and gamescope permanently muted and did a reinstall to fix lmao. Will try again later
duck9r
duck9rOP3d ago
The issue right now is that I have to use the same audio output (with the same shared volume level) for handheld speakers, headphones, and docked to a TV. For the TV, I have the volume all the way up so that the TV can be the volume control. But, if I forget to turn down the volume on the handheld when I’m done, I get blasted with sound when turning it back on I’m just trying to remove the forgetfulness/human element of it by making my output device at 0% on bootup

Did you find this page helpful?