dotfiles/bin/executable_get-volume.sh

14 lines
356 B
Bash

#!/bin/bash
muted=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F ' ' '{print $2}')
if [ $muted == "yes" ]; then
echo "{\"alt\": \"mute\", \"class\": \"muted\", \"tooltip\": \"muted\"}"
exit
fi
VOL=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk -F' ' '{print $5}' | sed -e 's/%$//')
echo "{\"percentage\": $VOL, \"tooltip\": \"$VOL%\"}"