diff options
author | Alex Kelly <kellya@arachnitech.com> | 2024-05-09 10:57:18 -0400 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-05-22 14:19:15 +0200 |
commit | deb6ce33c8828425ca1081742773d7235fdba206 (patch) | |
tree | 954baf5085d137dd04dd4420aef3a9cc971ed421 /rofi-sound-output-chooser | |
parent | 944aab752e2fc710184820aeee5d174b86c5233f (diff) | |
download | rofi-sound-devel.tar.gz |
Diffstat (limited to 'rofi-sound-output-chooser')
-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" |