dotfiles/system/.config/i3/i3bar/music.sh
Severin Kaderli cd781c174e Reroganize repository
Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
2018-12-12 21:41:12 +01:00

18 lines
414 B
Bash
Executable file

#!/bin/bash
# music.sh
QUERY="$(cmus-remote -Q)"
STATUS="$(echo "$QUERY" | grep -e "status " | cut -d " " -f 2)"
ARTIST="$(echo "$QUERY" | grep -e " artist " | cut -d " " -f 3-)"
TITLE="$(echo "$QUERY" | grep -e " title " | cut -d " " -f 3-)"
OUTPUT="$ARTIST - $TITLE"
if [ "$STATUS" != "playing" ]; then
OUTPUT="Not playing"
fi
# Escaping the & character
OUTPUT="${OUTPUT/\&/\&amp\;}"
echo -e "$OUTPUT"