-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummon
executable file
·58 lines (51 loc) · 1.81 KB
/
summon
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
#!/bin/zsh
NannyBotDir=$HOME/.config/nannybot
BName=$( cat ""$NannyBotDir"/config.ini" | grep Bname | awk '{print $3}' )
icondir=""$NannyBotDir"/icons/$BName"
echo "$NannyBotDir"
#check if prompt exists
if [ -f "$NannyBotDir"/current_prompt ]; then
"$NannyBotDir"/current_prompt
else
option=$(echo -e "1 Start Please.\n2 Shut down please.\n3 Restart please.\n4 Give next notifcation" | dmenu -p "Nannybot here, how can I help?" -i -l 30)
char="${option:0:1}"
case "${char}" in
1)
if [[ -f "$NannyBotDir"/is.running ]]; then
notify-send "I'm already up and at it!" --icon="$icondir/notify_default.png" -t 60000
else
notify-send "You got it! Starting now..." --icon="$icondir/notify_default.png" -t 60000
touch -f "$NannyBotDir"/is.running
"$NannyBotDir"/nannybot &
fi
;;
2)
if [[ ! -f "$NannyBotDir"/is.running ]]; then
notify-send "I'm already not running right now.
You'll always be able to access me in this menu though." --icon="$icondir/notify_thinking.png" -t 60000
else
notify-send "Alright. Bye now!" --icon="$icondir/notify_default.png" -t 60000
rm -f "$NannyBotDir"/is.running
fi
;;
3)
if [[ ! -f "$NannyBotDir"/is.running ]]; then
notify-send "I'm already not running right now, but let me start up for you!" --icon="$icondir/notify_default.png" -t 60000
else
rm -f "$NannyBotDir"/is.running
touch -f "$NannyBotDir"/is.reboot
notify-send "Restarting..." --icon="$icondir/notify_default.png" -t 60000
#sleep 2 is to have enough restart time to let all sub-scripts kill themselves
sleep 2
fi
touch -f "$NannyBotDir"/is.running
"$NannyBotDir"/nannybot &
;;
4)
touch -f "$NannyBotDir"/notifynow
;;
*)
notify-send "I'm sorry sweetie, but I'm not equipped to handle that" --icon="$icondir/notify_thinking.png" -t 60000
;;
esac
fi