Update select-sound-output.sh
This commit is contained in:
@@ -9,14 +9,17 @@ get_default_sink() {
|
||||
echo "error: getting default sink with wpctl failed with error code ${?}" >&2
|
||||
exit 1
|
||||
elif [[ ${first_line} =~ '^id ([0-9]+), ' ]]; then
|
||||
printf '%s' "${match}"
|
||||
pw-dump | jq -r --argjson def_sink "${match}" \
|
||||
'.[] | select(.id == $def_sink)
|
||||
| .info.props
|
||||
| "\(.["node.nick"]) - \(.["node.description"]) (\($def_sink))"'
|
||||
else
|
||||
echo "error: getting default sink with wpctl failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
let current_sink="$(get_default_sink)"
|
||||
local current_sink_desc="$(get_default_sink)"
|
||||
|
||||
local JQ_SCRIPT=$(<<'EOF'
|
||||
.[] | select(.type == "PipeWire:Interface:Node"
|
||||
@@ -57,7 +60,7 @@ done
|
||||
local fuzzel_index
|
||||
|
||||
fuzzel_index="$(printf '%s\0icon\x1f%s\n' ${fuzzel_ents} \
|
||||
| fuzzel -p "Cur: ${current_sink}> " --dmenu --index)"
|
||||
| fuzzel --mesg "Current: ${current_sink_desc}" --dmenu --index)"
|
||||
if (( ${?} )); then
|
||||
echo "Canceled by user" >&2
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user