#!/usr/bin/env sh

DEVICE=pulse
NAME=Master
URGENCY=low
EXPIRE=5000

ALSA_CMD="amixer -D $DEVICE"
NOTIFY_CMD="notify-send -u $URGENCY -t $EXPIRE VOLUME "

$ALSA_CMD sset $NAME "$1"
LEVEL=$($ALSA_CMD sget $NAME | awk -F"[][]" '/Left:/ { print $2 }')

notify-send -u $URGENCY \
  -h "int:value:$LEVEL" \
  -h string:x-dunst-stack-tag:volume_notif \
  -t $EXPIRE \
  "VOLUME: $LEVEL"