diff options
-rwxr-xr-x | rofi-sound-output-chooser | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rofi-sound-output-chooser b/rofi-sound-output-chooser index 5b67910..5fb5880 100755 --- a/rofi-sound-output-chooser +++ b/rofi-sound-output-chooser @@ -1,7 +1,17 @@ #!/usr/bin/env bash +LANG="en_US.utf8" # Outputs have spaces in them, so let's make \n the IFS IFS=$'\n' +# Make script independent on particular implementation of send client +if command -v notify-send > /dev/null 2>&1; then + SEND="notify-send" +elif command -v dunstify > /dev/null 2>&1; then + SEND="dunstify" +else + SEND="/bin/false" +fi + # An option was passed, so let's check it if [ "$@" ] then @@ -13,10 +23,10 @@ then if pactl set-default-sink "$device" then # if it worked, alert the user - dunstify -t 2000 -r 2 -u low "Activated: $desc" + $SEND -t 2000 -r 2 -u low "Activated: $desc" else # didn't work, critically alert the user - dunstify -t 2000 -r 2 -u critical "Error activating $desc" + $SEND -t 2000 -r 2 -u critical "Error activating $desc" fi else echo -en "\x00prompt\x1fSelect Output\n" |