pub / dotfiles

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

audio-output.sh (661B)


      1 #!/bin/bash
      2 
      3 CURRENT=$(wpctl status | sed -n '/^Audio$/,/Sink endpoints:$/p' | sed -n '/\[vol: .*\]/p' | grep '*')
      4 check_current () { if echo "$CURRENT" | grep -i "$1" &>/dev/null ; then echo true ; fi ; }
      5 
      6 case true in
      7     "$(check_current "HDMI")") echo '{"text": "HDMI", "alt": "hdmi"}' | jq --unbuffered --compact-output ;;
      8     "$(check_current "Wireless")") echo '{"text": "Headphone", "alt": "headphone"}' | jq --unbuffered --compact-output ;;
      9     "$(check_current "Galaxy buds")") echo '{"text": "Galaxy Buds", "alt": "buds"}' | jq --unbuffered --compact-output ;;
     10     *) echo '{"text": "??", "alt": "others"}' | jq --unbuffered --compact-output ;;
     11 esac