- out=$(echo Parsed_volume_1 volume $volume_level | zmqsend ||:)
- if [[ $out != "0 Success" ]]; then
- i3-nagbar -m "FAILED to set ffmpeg volume to $volume_level" -t error -f "pango:monospace 30"
+ if [[ $1 ]]; then
+ case $1 in
+ mute)
+ v=0
+ if [[ $2 == notify ]]; then
+ notify=true
+ fi
+ ;;
+ unmute)
+ v=1
+ ;;
+ *)
+ i3-nagbar -m "INVALID mute argument:$1" -t error -f "pango:monospace 30"
+ ;;
+ esac
+
+ else
+ v_state=$(cat $HOME/.iank-stream-muted) ||:
+ case $v_state in
+ 1) : ;; # default action
+ 0) v=1 ;;
+ *)
+ i3-nagbar -m "FAILED GETTING MUTE STATE:$v" -t error -f "pango:monospace 30"
+ ;;
+ esac
+ fi
+
+ out=$(echo Parsed_volume_1 volume $v | zmqsend ||:)
+ if [[ $out == "0 Success" ]]; then
+ echo $v >$HOME/.iank-stream-muted
+ if $notify; then
+ dunstify -h string:x-dunst-stack-tag:alert "automuted"
+ fi
+ else
+ i3-nagbar -m "FAILED ffmpeg volume:$v out:$out" -t error -f "pango:monospace 30"