#!/bin/bash

function print_volume() {
  if [ "$(pactl get-sink-mute @DEFAULT_SINK@)" = "Mute: yes" ]; then
  echo 0
  else
    echo "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed 's/[^0-9]//g')"
  fi
}

print_volume

pactl subscribe | awk '{ if($0 ~ "new") if($0 ~ "sink-input") {system("echo hi")} }' | while read -r event;do
  print_volume
done
