notify (582B)
1 #!/bin/sh 2 3 # Simple notification manager. 4 # Notifications are sent to a log file together with a time stamp. 5 # Requires: xroot-update (optional) 6 7 # Usage: notify [push MESSAGE | clean | edit | show] 8 9 update=xroot-update 10 file="${XDG_DATA_HOME:-.local/share}/notify" 11 date=$(date +'%H:%M') 12 13 usage() { 14 echo "Usage: notify [push MESSAGE | clean | edit | show]" 15 } 16 17 touch "$file" 18 case "$1" in 19 push) 20 echo "(Notified $date) $2" >> "$file" 21 $update 22 ;; 23 clean) 24 printf "" > "$file" 25 $update 26 ;; 27 edit) 28 $EDITOR "$file" 29 ;; 30 show) 31 cat "$file" 32 ;; 33 *) 34 usage 35 exit 1 36 ;; 37 esac