citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

timer (249B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 usage() {
      6 	printf "usage: timer 'food is ready!' 10min\n"
      7 	exit 0
      8 }
      9 
     10 if [ -z "$1" ]; then
     11 	usage
     12 fi
     13 
     14 now=$(date +%s)
     15 target=$(date -d "$2" +%s)
     16 
     17 duration=$(($target - $now))
     18 
     19 sleep $duration
     20 notify-send -u critical "$1"