summaryrefslogtreecommitdiff
path: root/.local/bin/timer
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/timer')
-rwxr-xr-x.local/bin/timer42
1 files changed, 20 insertions, 22 deletions
diff --git a/.local/bin/timer b/.local/bin/timer
index 4c33fb0..fc2652f 100755
--- a/.local/bin/timer
+++ b/.local/bin/timer
@@ -1,28 +1,26 @@
-#!/bin/sh
+#!/usr/local/bin/andy
-set -e
-
-abort()
-{
- notify 'Timer Interrupted' 'The timer was unexpectedly interrupted' \
- -u critical
- exit 1
+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
+ }
}
-export NOTIFY_LONG=timer
-export NOTIFY_SHORT=${0##*/}
+set -e NOTIFY_LONG timer
+set -e NOTIFY_SHORT `basename $args[0]
-if [ $# -eq 0 ]
-then
- echo 'Usage: timer duration [message]' >&2
+if test $#args -lt 2 {
+ echo 'Usage: timer duration [message]' >/dev/stderr
exit 1
-fi
-
-trap abort HUP INT QUIT ABRT KILL ALRM TERM
+}
-if sleep "$1"
-then
- notify 'Timer Finished' "$2"
-else
- abort
-fi
+if sleep $args[1] {
+ notify 'Timer Finished' $args[2]
+} else {
+ sigint
+}