pub / sway-config

Configuration for the Sway Wayland Compositor
git clone src.jayvii.de/pub/sway-config.git
Home | Log | Files | Exports | Refs | RSS

get-volume.sh (636B)


      1 #!/bin/bash
      2 
      3 # the metadata only contains the name of the default sink
      4 default_sink_name=$(pw-metadata 0 'default.audio.sink' | grep 'value' | sed "s/.* value:'//;s/' type:.*$//;" | jq .name)
      5 default_sink_id=$(pw-dump Node Device | jq '.[].info.props|select(."node.name" == '" $default_sink_name "') | ."object.id"')
      6 if pw-cli enum-params "$default_sink_id" 'Props' | grep -A 1 "Spa:Pod:Object:Param:Props:mute" | grep true &>/dev/null ; then
      7     echo 0
      8 else
      9     echo "$(pw-cli enum-params "$default_sink_id" 'Props' | grep -A 2 'Spa:Pod:Object:Param:Props:channelVolumes' | awk '/Float / {gsub(/.*Float\s/," "); print $1^(1/3) }')"
     10 fi