pub / dotfiles

Configuration of software on my computer
git clone https://src.jayvii.de/pub/dotfiles.git
Home | Log | Files | Exports | Refs | RSS

audio.sh (796B)


      1 #!/bin/bash
      2 
      3 CURRENT=$(wpctl status | sed -n '/^Audio$/,/Sink endpoints:$/p' | sed -n '/\[vol: .*\]/p' | grep '*')
      4 VOLUME=`echo "$(get-volume)*100" | bc | cut -d'.' -f1`
      5 
      6 if echo "$CURRENT" | grep -i "HDMI" &>/dev/null ; then
      7     echo '{"text": "'$VOLUME'", "alt": "hdmi"}' | jq --unbuffered --compact-output
      8 elif echo "$CURRENT" | grep "Wireless" &>/dev/null ; then
      9     echo '{"text": "'$VOLUME'", "alt": "headphone"}' | jq --unbuffered --compact-output
     10 elif echo "$CURRENT" | grep "Galaxy Buds" &>/dev/null ; then
     11     # "percentage": '$(buds_battery.py A8:87:B3:01:80:07 | tr ',' '\n' | sort -n | head -n 1 || echo 1)'
     12     echo '{"text": "'$VOLUME'", "alt": "buds"}' | jq --unbuffered --compact-output
     13 else
     14     echo '{"text": "'$VOLUME'", "alt": "other"}' | jq --unbuffered --compact-output
     15 fi