blob: ffe8f368f23727bcc671a99abb32aea7ed5b2023 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/sh
# This is a static status module, for a dynamic one, there is the option
# with zscroll.
icon=""
length=50
delay=0.1
b_padding="$icon "
a_padding=""
p_padding=" | "
show_panel (){
zscroll -d $delay -l $length \
-M "pctl_status status" \
-m "Playing" "--scroll-padding '$p_padding' --scroll 1" \
-m "Paused" "--scroll 0" \
-m "Stopped" "--scroll 0" \
-m "NRP" "--scroll 0" \
-u true "pctl_status text" &
wait
}
send_notification (){
player_status="$(pctl_status status)"
metadata="$(pctl_status get-metadata)"
contains_album="$(echo $metadata | cut -d'>' -f1)"
artist=
album=
title=
summary=
body=
pp_icon=
if [ "$player_status" = "Playing" ] || [ "$player_status" = "Paused" ]; then
if [ "$contains_album" = "yes" ]; then
artist="$(echo $metadata | cut -d'>' -f2)"
album="$(echo $metadata | cut -d'>' -f3)"
title="$(echo $metadata | cut -d'>' -f4)"
summary="$artist ($album)"
body="$title"
else
artist="$(echo $metadata | cut -d'>' -f2)"
title="$(echo $metadata | cut -d'>' -f3)"
summary="$artist"
body="$title"
fi
if [ "$player_status" = "Playing" ]; then
pp_icon=""
else
pp_icon=""
fi
notify-send -u low "$icon $pp_icon $summary" "$body"
else
notify-send -u low "$icon Nothing playing"
fi
}
case $1 in
show)
show_panel
;;
notify)
send_notification
;;
esac
|