aboutsummaryrefslogtreecommitdiff
path: root/i3blocks/i3music.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:40 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:40 +0100
commit590e1b8feeab5949cc94dbfb7237676186fc0527 (patch)
treeea544eddf85dc10a0b6a57ef4713561c48c2e7b5 /i3blocks/i3music.sh
parentb022a45f840b0b8d12e7e6cddd0b49fd0317afa7 (diff)
downloadscripts-590e1b8feeab5949cc94dbfb7237676186fc0527.tar.gz
scripts-590e1b8feeab5949cc94dbfb7237676186fc0527.zip
Several changes.
Diffstat (limited to 'i3blocks/i3music.sh')
-rwxr-xr-xi3blocks/i3music.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh
index 6cb9f10..3aa764e 100755
--- a/i3blocks/i3music.sh
+++ b/i3blocks/i3music.sh
@@ -1,12 +1,20 @@
#!/bin/bash
+case $BLOCK_BUTTON in
+ 1) cmus-remote -r ;;
+ 2) cmus-remote -u ;;
+ 3) cmus-remote -n ;;
+esac
+
status=$(cmus-remote -Q | grep status | awk '{print $2}')
+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-)
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"
+elif [ $status = "paused" ]; then
+ echo "( $artist ─ $title )"
else
echo "$status"
fi