aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-03-21 12:37:12 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-03-21 12:37:12 +0100
commita16e1c23fa59ff36e43bbb2adb3d2421ba7a7369 (patch)
tree3a71592d8e290a2cdbb956bb37c0f8ad3305154e
parent0799d2ef6f9f5e7c8f50fb927165fb868176fdf4 (diff)
downloadscripts-a16e1c23fa59ff36e43bbb2adb3d2421ba7a7369.tar.gz
scripts-a16e1c23fa59ff36e43bbb2adb3d2421ba7a7369.zip
Fixed ampersand problems in author and regular title.
-rwxr-xr-xi3blocks/i3music.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh
index fb5bc07..cad0b66 100755
--- a/i3blocks/i3music.sh
+++ b/i3blocks/i3music.sh
@@ -7,12 +7,13 @@ case $BLOCK_BUTTON in
esac
symbol=🎵
+ampersand="I"
pgrep -x cmus >/dev/null || exit 0
-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-)"
+stat="$(cmus-remote -Q | grep "^status " | awk '{print $2}' | sed "s/&/$ampersand/")"
+artist="$(cmus-remote -Q | grep "^tag artist " | cut -d' ' -f3- | sed "s/&/$ampersand/")"
+title="$(cmus-remote -Q | grep "^tag title " | cut -d' ' -f3- | sed "s/&/$ampersand/")"
[ -z "$artist" ] && artist="(unknown)"
-[ -z "$title" ] && title="$(basename "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2- | sed 's/&/+/')")" # sed to fix & in title messing up script
+[ -z "$title" ] && title="$(basename "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2- | sed "s/&/$ampersand/")")" # sed to fix & in title messing up script
if [ "$stat" = "playing" ]; then
#echo "$symbol $artist ─ $title"
echo "$symbol $artist ─ $title"