From d0e882a1b6d30221f7c67b5285ff2f57c5831ae6 Mon Sep 17 00:00:00 2001 From: zegonix Date: Wed, 11 Jun 2025 23:02:45 +0200 Subject: [PATCH] (scripts) added check to exit script on empty selection --- scripts/select-audio-sink.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/select-audio-sink.sh b/scripts/select-audio-sink.sh index e9b7cda..66d0c22 100755 --- a/scripts/select-audio-sink.sh +++ b/scripts/select-audio-sink.sh @@ -13,7 +13,17 @@ select_audio_sink() { return 1 fi - selection="$(printf "%s\n" "${names[@]//\"/}" | fuzzel --lines ${#names[@]} --dmenu)" + if ((${#ids[@]} > 16)); then + lines=16 + else + lines=${#ids[@]} + fi + + selection="$(printf "%s\n" "${names[@]//\"/}" | fuzzel --lines ${lines} --dmenu)" + + if [[ -z "${selection}" ]]; then + return 1 + fi unset number for n in ${!names[@]}; do