#!/usr/bin/env bash # # Shows microphone mute status for the default audio source. # Left click toggles mute. . ~/bin/i3blocks/_utils mic_mute() { if [[ "$BLOCK_BUTTON" == "1" ]]; then wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle fi local wpctl_output wpctl_output=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@) local muted muted=$(echo "$wpctl_output" | grep -c '\[MUTED\]') local bg fg icon stat if [[ "$muted" -ge 1 ]]; then bg=$mute_bg fg=$mute_fg stat="MUT" else bg=$crit_bg fg=$crit_fg stat="REC" fi echo -e "MIC $stat \n" } mic_mute