#!/bin/sh get_vol() { pactl get-sink-volume @DEFAULT_SINK@ | grep -oE -m 1 '[1-9]+%' | head -n1 } update_bar() { test -e /tmp/bar.fifo || return 0 perc="$(get_vol)" echo "V vol: ${perc}" >> /tmp/bar.fifo } case "$1" in +) pactl set-sink-volume @DEFAULT_SINK@ +5% update_bar ;; -) pactl set-sink-volume @DEFAULT_SINK@ -5% update_bar ;; .) pactl set-sink-mute @DEFAULT_SINK@ toggle ;; !) pactl set-source-mute @DEFAULT_SOURCE@ toggle ;; *) { echo "usage: $0 +/-/./!" echo ". to toggle output" echo "! to toggle mic" } >&2 exit 1 ;; esac