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
|
echo "error: getting default sink with wpctl failed with error code ${?}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ ${first_line} =~ '^id ([0-9]+), ' ]]; then
|
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
|
else
|
||||||
echo "error: getting default sink with wpctl failed" >&2
|
echo "error: getting default sink with wpctl failed" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
let current_sink="$(get_default_sink)"
|
local current_sink_desc="$(get_default_sink)"
|
||||||
|
|
||||||
local JQ_SCRIPT=$(<<'EOF'
|
local JQ_SCRIPT=$(<<'EOF'
|
||||||
.[] | select(.type == "PipeWire:Interface:Node"
|
.[] | select(.type == "PipeWire:Interface:Node"
|
||||||
@@ -57,7 +60,7 @@ done
|
|||||||
local fuzzel_index
|
local fuzzel_index
|
||||||
|
|
||||||
fuzzel_index="$(printf '%s\0icon\x1f%s\n' ${fuzzel_ents} \
|
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
|
if (( ${?} )); then
|
||||||
echo "Canceled by user" >&2
|
echo "Canceled by user" >&2
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user