commit 6e400767c930e4d35366e9b8d0d842e0128e2383 parent 02916c143ea12863b7c0f617e8ca8ca21a3d8063 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 27 Feb 2020 09:12:42 +0100 Allow radio script to run interactively from term or X Diffstat:
M | .local/bin/radio | | | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/.local/bin/radio b/.local/bin/radio @@ -14,8 +14,14 @@ WBGO" lines=10 prompt="station: " -#t="$(printf '%s' "$n" | dmenu -i -l "$lines" -p "$prompt")" -t="$(printf '%s' "$n" | fzy -l "$lines" -p "$prompt")" +if [ -z "$TERM" ]; then + t="$(printf '%s' "$n" | dmenu -i -l "$lines" -p "$prompt")" +else + t="$(printf '%s' "$n" | fzy -l "$lines" -p "$prompt")" +fi +if [ -z "$t" ]; then + exit 1 +fi case "$t" in bitreich) @@ -42,7 +48,7 @@ case "$t" in u="http://wbgo.streamguys.net/wbgo128";; *) printf 'unknown station %s\n' "$t" - exit 1;; + exit 2;; esac mpv "$u"