diff options
Diffstat (limited to '')
| -rwxr-xr-x | event | 19 |
1 files changed, 19 insertions, 0 deletions
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | file="$HOME/box/events" # Change to $XDG_DATA_HOME/events or whatever | 8 | file="$HOME/box/events" # Change to $XDG_DATA_HOME/events or whatever |
| 9 | editor=${EDITOR:-vi} | 9 | editor=${EDITOR:-vi} |
| 10 | notify=${NOTIFY:-"notify push"} | ||
| 10 | 11 | ||
| 11 | usage() { | 12 | usage() { |
| 12 | echo "Usage: event [command]" | 13 | echo "Usage: event [command]" |
| @@ -19,6 +20,8 @@ usage() { | |||
| 19 | echo " date: now, n; today, t; tomorrow, tm;" | 20 | echo " date: now, n; today, t; tomorrow, tm;" |
| 20 | echo " week, w; nextweek, nw;" | 21 | echo " week, w; nextweek, nw;" |
| 21 | echo " future, f; past, p" | 22 | echo " future, f; past, p" |
| 23 | echo " notify-loop Notify of all past events, then start a loop that" | ||
| 24 | echo " checks for events every minute and notifies" | ||
| 22 | } | 25 | } |
| 23 | 26 | ||
| 24 | secondstoday() { | 27 | secondstoday() { |
| @@ -148,6 +151,22 @@ case "$1" in | |||
| 148 | list) | 151 | list) |
| 149 | cat "$file" | list $2 | sort | 152 | cat "$file" | list $2 | sort |
| 150 | ;; | 153 | ;; |
| 154 | notify-loop) | ||
| 155 | clean="sed -E 's/....-..-.. .{1,2}:..[[:space:]]*//g'" | ||
| 156 | cat "$file" | list past | sort | \ | ||
| 157 | sed -E 's/....-..-.. .{1,2}:..[[:space:]]*//g' | \ | ||
| 158 | while read text; do | ||
| 159 | $notify "$text" | ||
| 160 | done & | ||
| 161 | while true; do | ||
| 162 | cat "$file" | list now | sort | \ | ||
| 163 | sed -E 's/....-..-.. .{1,2}:..[[:space:]]*//g' | \ | ||
| 164 | while read text; do | ||
| 165 | $notify "$text" | ||
| 166 | done & | ||
| 167 | sleep $((60 - $(date +%-S))) | ||
| 168 | done | ||
| 169 | ;; | ||
| 151 | *) | 170 | *) |
| 152 | usage | 171 | usage |
| 153 | ;; | 172 | ;; |
