dotfiles/scripts/volstat
tavo-wasd fd69ecbbe6 init
2023-05-08 20:39:39 -06:00

15 lines
446 B
Bash
Executable file

#!/bin/sh
# Fetch current audio levels
# (in current default output)
# Get volume levels
vol=$(amixer | grep "Playback" | grep -o '[0-9]*[0-9]%' | head -n 1)
# If device is off (muted), notify mute, print volume otherwise
if amixer scontents | grep "Playback" | grep -q "\[off\]"; then
echo " M"
notify-send -u low --replace-id=10 "󰖁 Volume" "Mute"
else
echo "$vol"
notify-send -u low --replace-id=10 "󰕾 Volume" "$vol"
fi