aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcmusShow.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmusShow.sh b/cmusShow.sh
new file mode 100755
index 0000000..a28d8f2
--- /dev/null
+++ b/cmusShow.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Shows a notification with info about the current playing song.
+
+getCmusInfo() {
+ cmus-remote -Q | grep "^${1} " | cut -d' ' -f "${2}-"
+}
+
+sToTime() {
+ min=$(( $1 / 60 ))
+ s=$(( $1 % 60 ))
+ [ "$s" -lt 10 ] && s="0${s}"
+ echo "${min}:${s}"
+}
+
+artist="$(getCmusInfo 'tag artist' '3')"
+album="$(getCmusInfo 'tag album' '3')"
+title="$(getCmusInfo 'tag title' '3')"
+position="$(getCmusInfo 'position' '2')"
+duration="$(getCmusInfo 'duration' '2')"
+dunstify -r "$(dunstifyIDs.sh cmusShow)" "${title}" "${artist} - ${album}\n$(sToTime ${position}) - $(sToTime ${duration})"