-
Notifications
You must be signed in to change notification settings - Fork 1
/
rotify.sh
executable file
·68 lines (59 loc) · 1.31 KB
/
rotify.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
package="rotify"
config="~/.config/rotify/config.yml"
immediate=0
sender=0
delete=0
print_help() {
echo "$package - send/read Gotify notifications"
echo " "
echo "$package [options]"
echo " "
echo "options:"
echo "-c config path [default ~/.config/rotify/config.yml]"
echo "-s send notification via rofi"
echo "-r read notifications via rofi"
echo "-d delete all notifications without rofi"
echo "-i send selected text without rofi"
echo "-h show this help"
exit 1
}
if test $# -eq 0;
then
print_help
fi
while getopts 'c:srdih' OPTION; do
case "$OPTION" in
c)
config=$OPTARG;
;;
s)
sender=1;
;;
r)
sender=0;
;;
d)
delete=1;
;;
i)
immediate=1;
;;
?)
print_help
;;
esac
done
shift "$(($OPTIND -1))"
if [ $immediate -eq 1 ]; then
message="`xsel`"
exec ~/scripts/notify -c "$config" "$message"
fi
if [ $delete -eq 1 ]; then
exec ~/scripts/checknotifs -c "$config" -r
fi
if [ $sender -eq 1 ]; then
exec rofi -show notify -modi notify:~/scripts/notify -c "$config"
else
exec rofi -show check-notifs -modi check-notifs:~/scripts/checknotifs
fi