-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpolytiramisu.sh
40 lines (31 loc) · 1.17 KB
/
polytiramisu.sh
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
#!/bin/sh
# Show tiramisu notifications in polybar.
# How many seconds notification is displayed:
display_duration=7.0
# Maximum number of characters:
char_limit=150
# Replace app names with nerd font logos
use_nerd_font="false"
# Stop old tiramisu processes if any:
pgrep -x tiramisu >/dev/null && killall tiramisu
# Start a new tiramisu process:
tiramisu -o '#summary #body' |
while read -r line; do
# Replace app names with icons
if [ $use_nerd_font == "true" ]; then
line="$(echo "$line" | sed -r 's/Telegram Desktop//')"
line="$(echo "$line" | sed -r 's/NordVPN//')"
line="$(echo "$line" | sed -r 's/VLC//')"
line="$(echo "$line" | sed -r 's/Kdenlive//')"
line="$(echo "$line" | sed -r 's/Wifi//')"
line="$(echo "$line" | sed -r 's/Firefox//')"
fi
# Cut notification by character limit:
if [ "${#line}" -gt "$char_limit" ]; then
line="$(echo "$line" | cut -c1-$((char_limit-1)))…"
fi
# Display notification for the duration time:
echo "$line"
sleep "$display_duration"
echo " "
done