aboutsummaryrefslogtreecommitdiff
path: root/i3blocks/i3music.sh
diff options
context:
space:
mode:
Diffstat (limited to 'i3blocks/i3music.sh')
-rwxr-xr-xi3blocks/i3music.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh
new file mode 100755
index 0000000..6cb9f10
--- /dev/null
+++ b/i3blocks/i3music.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+status=$(cmus-remote -Q | grep status | awk '{print $2}')
+if [ $status = "playing" ]; then
+ artist=$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-)
+ title=$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)
+ [ -z $artist ] && artist="(unknown)"
+ [ -z $title ] && title=$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)
+ echo "$artist ─ $title"
+else
+ echo "$status"
+fi