-
Notifications
You must be signed in to change notification settings - Fork 1
/
timer.tool
executable file
·50 lines (44 loc) · 1.17 KB
/
timer.tool
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
#!/bin/bash
# timer with message and alarm sound
while (( "$#" )); do
case $1 in
-m|--message)
message="$2"
shift
shift
;;
-s|--sound)
sound="true"
shift
;;
-h|--help)
name="$(basename "$0")"
echo "NAME"
echo " $name - timer with notification"
echo
echo "SYNOPSIS"
echo " $name [OPTIONS] TIME"
echo
echo "OPTIONS"
echo " -m, --message"
echo " Set the timer message"
echo
echo " -s, --sound"
echo " Turn on timer sound"
echo
echo " -h, --help"
echo " Send this help message"
exit
;;
*)
input="$1"
shift
;;
esac
done
[[ ! "$input" ]] && echo "Time not set" && exit
{
sleep "$input"
notify-send -u critical -i "timer" -a "timer" "Time is up: $input" "$message"
[[ $sound ]] && mpv --no-video "$DOTFILES/assets/timer.mp3" &>/dev/null
} & disown