From 654d7cf14fcb243cea8104c1d34c83c40189ba2b Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Tue, 23 Mar 2021 23:07:02 +1030 Subject: [PATCH] added failsafe to choice script so that no error occurs when closing dmenu without a choice --- .scripts/set-sound-card | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.scripts/set-sound-card b/.scripts/set-sound-card index 1dd2a1a..e55b7d1 100755 --- a/.scripts/set-sound-card +++ b/.scripts/set-sound-card @@ -2,6 +2,10 @@ choice=$(pactl list short sinks | awk '{print $2}' | dmenu -i -p "which sink should be default?") +if [ $choice=="" ] ; then + exit 0; +fi + rm /tmp/pactl-default-sink --force # to ignore if it isn't there echo "$choice" >> /tmp/pactl-default-sink pactl set-default-sink $choice # make sure that the chosen sink is the \ No newline at end of file