1
0
mirror of https://github.com/alrayyes/i3blocks synced 2023-11-13 18:16:40 +00:00

Added cmus script

This commit is contained in:
Ryan 2016-11-22 19:47:30 +01:00
parent 9974846fe5
commit 36680fd035
2 changed files with 67 additions and 0 deletions

View File

@ -141,6 +141,48 @@ color=#00FF00
interval=30 interval=30
``` ```
# cmus
## Description
Prints current song playing in [cmus](https://cmus.github.io/)
## Source
```shell
#!/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
```
## i3blocks config
```shell
[cmus]
label=
command=~/i3blocks/cmus
interval=5
```
# License # License
This theme is released under the MIT License. For more information read the [license][license]. This theme is released under the MIT License. For more information read the [license][license].

25
cmus Executable file
View File

@ -0,0 +1,25 @@
#!/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