From d5a6b65c28795f363f9df6b12a0a1f226d846493 Mon Sep 17 00:00:00 2001 From: "Archie Hilton (thytom)" Date: Wed, 6 Nov 2019 16:16:49 +0000 Subject: [PATCH] Fixed mpd module to disappear when not active --- bar.sh | 4 +++- modules/mpd | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bar.sh b/bar.sh index 86d12f0..1a98bf1 100755 --- a/bar.sh +++ b/bar.sh @@ -46,7 +46,9 @@ run_module() out="$($DEFAULT_MODULES_DIR$1)" fi - if [[ ! "$out" = "" ]]; then + if [[ "$out" = " " ]]; then + echo " " > "$OUTPUT_CACHE$module" + elif [[ ! "$out" = "" ]]; then out="$out$SEPARATOR." echo "$out" > "$OUTPUT_CACHE$module" fi diff --git a/modules/mpd b/modules/mpd index 67c319f..ecbdd4e 100755 --- a/modules/mpd +++ b/modules/mpd @@ -1,13 +1,14 @@ #!/bin/bash -PREFIX_PLAY=' ' -PREFIX_PAUSE=' ' +PREFIX_PLAY=' ' +PREFIX_PAUSE=' ' get_mpd() { current_song="$(mpc current)" if [[ "$current_song" = "" ]]; then + echo " " exit 0 else playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}')