aboutsummaryrefslogtreecommitdiff
path: root/cmusShow.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmusShow.sh')
-rwxr-xr-xcmusShow.sh23
1 files changed, 17 insertions, 6 deletions
diff --git a/cmusShow.sh b/cmusShow.sh
index a28d8f2..8a5c576 100755
--- a/cmusShow.sh
+++ b/cmusShow.sh
@@ -2,6 +2,12 @@
# Shows a notification with info about the current playing song.
+scriptName="${0##*/}"
+[ "$(pgrep "${scriptName}" | wc -l)" -gt "2" ] && exit 0
+
+notificationFreq=0.1
+steps=20
+
getCmusInfo() {
cmus-remote -Q | grep "^${1} " | cut -d' ' -f "${2}-"
}
@@ -13,9 +19,14 @@ sToTime() {
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})"
+i=0
+while [ "$i" -lt "$steps" ]; do
+ 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)" -t 250 "${title}" "${artist} - ${album}\n$(sToTime "${position}") - $(sToTime "${duration}")"
+ sleep "$notificationFreq"
+ i=$((i+1))
+done