-
Notifications
You must be signed in to change notification settings - Fork 0
/
dunst.sh
executable file
·49 lines (38 loc) · 935 Bytes
/
dunst.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
41
42
43
44
45
46
47
48
#!/usr/bin/bash
#
# Script to toogle dunst notification history
#
# Author : https://github.com/Crash-Zeus
readonly command=$1
readonly maxDisplayNumber=$2
function display_history {
history=$(dunstctl history)
if [ "$maxDisplayNumber" != "" ] ; then
maxNumber=$maxDisplayNumber
else
maxNumber=$(echo $history | jq .'data[0] | length')
fi
for (( i=0; i< $maxNumber; i++ ))
do
id=$(echo $history | jq ."data[0][$i].id.data")
dunstctl history-pop $id
done
}
function close_history {
dunstctl close-all
}
case $command in
"display-history")
display_history $maxDisplayNumber
;;
"close-history")
close_history
;;
*)
echo "No command specified."
echo -e "\nAvailable commands :\n
display_history [display number | {history number}]\n
close_history"
exit 1
;;
esac