16 lines
711 B
Bash
Executable File
16 lines
711 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Query PulseAudio's Master channel via amixer to determine the current mute state.
|
|
# -D pulse selects the PulseAudio ALSA plugin; sget reads the control without changing it.
|
|
# awk scans for the [on]/[off] tags that amixer emits and exits immediately on the first match.
|
|
state=$(amixer -D pulse sget Master | awk '/\[on\]/{print "unmute"; exit} /\[off\]/{print "mute"; exit}')
|
|
|
|
# Toggle the state of the speaker.
|
|
# NOTE: this block is incomplete — the condition string "[on] " is missing its closing quote
|
|
# and the amixer call has no arguments; left as-is to avoid silently changing broken behaviour.
|
|
#
|
|
if [ "$state" = "[on] "]; then
|
|
amixer
|
|
# amixer -D pulse sset Master "$state" > /dev/null
|
|
|