aboutsummaryrefslogtreecommitdiff
path: root/i3/blocks/playerctl
diff options
context:
space:
mode:
authorNeodarZ <neodarz@neodarz.ovh>2016-09-21 20:06:02 +0200
committerNeodarZ <neodarz@neodarz.ovh>2016-09-21 20:06:02 +0200
commitf0b7ce9877b22014022ff1a3035a2f3be262b337 (patch)
treea37046f05a746886bb336ec42e8997632cd0aaf9 /i3/blocks/playerctl
parentafb981f0fe8fa0de77f7451d6907f5094c38f1b5 (diff)
parent78db7d43845d3ea276b8028bec6d67b5a5641a1b (diff)
downloaddotfiles-f0b7ce9877b22014022ff1a3035a2f3be262b337.tar.xz
dotfiles-f0b7ce9877b22014022ff1a3035a2f3be262b337.zip
Ajout de la police awesome
Diffstat (limited to 'i3/blocks/playerctl')
-rwxr-xr-xi3/blocks/playerctl39
1 files changed, 39 insertions, 0 deletions
diff --git a/i3/blocks/playerctl b/i3/blocks/playerctl
new file mode 100755
index 0000000..6d613ed
--- /dev/null
+++ b/i3/blocks/playerctl
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Based on https://aur.archlinux.org/packages/playerctl/
+
+INSTANCE="${BLOCK_INSTANCE}"
+
+if [[ "${INSTANCE}" != "" ]]; then
+ ARGUMENTS="--player ${INSTANCE}"
+fi
+
+ICON_PLAY="➤"
+ICON_PAUSE="Ⅱ"
+ICON_STOP="≠"
+CUR_ICON=""
+
+if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then
+ $(playerctl ${ARGUMENTS} previous)
+elif [[ "${BLOCK_BUTTON}" -eq 2 ]]; then
+ $(playerctl ${ARGUMENTS} play-pause)
+elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then
+ $(playerctl ${ARGUMENTS} next)
+fi
+
+PLAYER_STATUS=$(playerctl ${ARGUMENTS} status)
+INFO_TITLE=$(playerctl ${ARGUMENTS} metadata title)
+INFO_ALBUM=$(playerctl ${ARGUMENTS} metadata album)
+INFO_ARTIST=$(playerctl ${ARGUMENTS} metadata artist)
+
+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 \ No newline at end of file