1
0
mirror of https://github.com/alrayyes/i3blocks synced 2023-11-13 18:16:40 +00:00
i3blocks/cmus
2016-11-22 19:47:30 +01:00

26 lines
692 B
Bash
Executable File

#!/bin/sh
ICON_PLAY="➤"
ICON_PAUSE="Ⅱ"
ICON_STOP="≠"
CUR_ICON=""
INFO_ARTIST=$(cmus-remote -Q | grep ' artist ' | cut -d ' ' -f3-)
INFO_ALBUM=$(cmus-remote -Q | grep ' album ' | cut -d ' ' -f3-)
INFO_TITLE=$(cmus-remote -Q | grep ' title ' | cut -d ' ' -f3-)
PLAYER_STATUS=$(cmus-remote -Q | grep 'status' | cut -d ' ' -f2-)
if [[ "${PLAYER_STATUS}" = "paused" ]]; then
CUR_ICON="${ICON_PAUSE}"
elif [[ "${PLAYER_STATUS}" = "playing" ]]; then
CUR_ICON="${ICON_PLAY}"
else
CUR_ICON="${ICON_STOP}"
fi
if [[ "${INFO_TITLE}" != "" ]] && [[ "${INFO_ARTIST}" != "" ]]; then
echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}"
echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}"
fi