diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2018-12-27 18:47:48 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2018-12-27 18:47:48 +0100 |
commit | d165a641d16c181e6251737b9c86d6bf178370be (patch) | |
tree | b9e20f0ac05633285630c857f0d5b1056d6a902d /i3blocks/i3music.sh | |
parent | 82cd5e57e2ecb878396e4703ee2eb4cc0bba3c9e (diff) | |
download | scripts-d165a641d16c181e6251737b9c86d6bf178370be.tar.gz scripts-d165a641d16c181e6251737b9c86d6bf178370be.zip |
jue dic 27 18:47:51 CET 2018
Diffstat (limited to 'i3blocks/i3music.sh')
-rwxr-xr-x | i3blocks/i3music.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh index 8dfd408..4811e08 100755 --- a/i3blocks/i3music.sh +++ b/i3blocks/i3music.sh @@ -1,9 +1,9 @@ #!/bin/sh case $BLOCK_BUTTON in - 1) pgrep -x cmus && cmus-remote -r ;; - 2) pgrep -x cmus && cmus-remote -u ;; - 3) pgrep -x cmus && cmus-remote -n ;; + 1) pgrep -x cmus >/dev/null && cmus-remote -r ;; + 2) pgrep -x cmus >/dev/null && cmus-remote -u ;; + 3) pgrep -x cmus >/dev/null && cmus-remote -n ;; esac symbol=🎵 @@ -11,12 +11,12 @@ pgrep -x cmus >/dev/null || (echo "$symbol" && exit) stat="$(cmus-remote -Q | grep "status " | awk '{print $2}')" artist="$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-)" title="$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)" -[[ -z "$artist" ]] && artist="(unknown)" -[[ -z "$title" ]] && title="$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)" +[ -z "$artist" ] && artist="(unknown)" +[ -z "$title" ] && title="$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)" if [ "$stat" = "playing" ]; then echo "$symbol $artist ─ $title" elif [ "$stat" = "paused" ]; then - echo "( $symbol $artist ─ $title )" + echo "$symbol ( $artist ─ $title )" else echo "$symbol $stat" fi |