blob: 8a5c576ec3dd41ab21de8352016674078cb66780 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
# 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}-"
}
sToTime() {
min=$(( $1 / 60 ))
s=$(( $1 % 60 ))
[ "$s" -lt 10 ] && s="0${s}"
echo "${min}:${s}"
}
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
|