summaryrefslogtreecommitdiff
path: root/.local/bin/timer
blob: fc2652fe5eb3324bea5003c27b321fc272760f25 (plain) (blame)
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
#!/usr/local/bin/andy

for sig in hup int quit abrt kill alrm term {
	func sig$sig {
		notify (
			'Timer Interrupted'
			'The timer was unexpectedly interrupted'
			-u critical
		)
		exit 1
	}
}

set -e NOTIFY_LONG  timer
set -e NOTIFY_SHORT `basename $args[0]

if test $#args -lt 2 {
	echo 'Usage: timer duration [message]' >/dev/stderr
	exit 1
}

if sleep $args[1] {
	notify 'Timer Finished' $args[2]
} else {
	sigint
}