#!/bin/bash

#technically, this is the volume for the left speaker, but if the left and right speaker are toggled together
#then this is OK.

IS_TOGGLED_OFF=$(amixer -D pulse get Master | grep -Ec '\[off\]')

if [[ "$IS_TOGGLED_OFF" -eq 0 ]]; then
    MASTER_VOLUME=$(amixer -D pulse get Master | grep -Eo -m1  '[0-9]{1,3}%')
else
    MASTER_VOLUME="muted"
fi   

echo $MASTER_VOLUME
