-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdtimer
More file actions
executable file
·30 lines (22 loc) · 782 Bytes
/
dtimer
File metadata and controls
executable file
·30 lines (22 loc) · 782 Bytes
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
#!/bin/bash
#viyoriya
PROMPT=" Start Timer "
timerFile="/tmp/.timerFile" #move it to ~/.config/ so it will be persisted even after reboot
MINS=$(printf '%s min\n' {1..60})
HOURS=$(printf '%s hr\n' {1..8})
timer=$(printf "%s\n%s" "$MINS" "$HOURS" | dmenu -i -p "$PROMPT")
if [ -n "$timer" ]; then
timeValue=$(echo "$timer" | awk '{print $1}')
minsOrhrs=$(echo "$timer" | awk '{print $2}')
if [[ "$minsOrhrs" == "min" ]]; then
[ -f $timerFile ] && rm $timerFile
echo "$(date +'%H:%M') $timeValue minutes" >> $timerFile
elif [[ "$minsOrhrs" == "hr" ]]; then
[ -f $timerFile ] && rm $timerFile
echo "$(date +'%H:%M') $((timeValue * 60)) minutes" >> $timerFile
else
exit 0
fi
else
exit 0
fi