1

I'm trying to look for a command that outputs 1 or 0 depending on whether I have my output muted.

I was trying this:

amixer sget Master

This is the output I get:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 64 [100%] [0.00dB] [on]

Now the values change here accordingly (if I decrease volume, the percentage and the dB values change). However, if I head into Pavucontrol and mute my output on the 'Output devices' tab, the output of the command above stays the same. Literally nothing changes. But my sound indeed is muted.

What command should I use? Why doesn't that [on] change to [off]? Shouldn't it?

Thanks in advance.

2

After a long search, I actually managed to find an answer. This might be helpful for others looking for something like this out there!

What you need:

pacmd list-sinks

This command has a line like this:

muted: no

And this no indeed does change to yes, when I mute my device. Perfect. I managed to strip the output using this command, should anyone need it:

pacmd list-sinks | awk '/muted/ { print $2 }'

Sorry for posting too soon, it seemed like I won't be able to find a solution anywhere.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.