aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-12-23 10:22:02 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2024-12-23 10:22:02 +0100
commit49f83b383d9048ce3d620a91a4005245aa1599dc (patch)
tree79c4490cb994f6b7db29e50d3a247e052fc16762
parent7d3dc968b6183f51dc2594c80450372f0c8fb811 (diff)
downloadscripts-49f83b383d9048ce3d620a91a4005245aa1599dc.tar.gz
scripts-49f83b383d9048ce3d620a91a4005245aa1599dc.zip
Added notify-loop
Diffstat (limited to '')
-rwxr-xr-xevent19
1 files changed, 19 insertions, 0 deletions
diff --git a/event b/event
index 16991cf..94dfbfb 100755
--- a/event
+++ b/event
@@ -7,6 +7,7 @@
7 7
8file="$HOME/box/events" # Change to $XDG_DATA_HOME/events or whatever 8file="$HOME/box/events" # Change to $XDG_DATA_HOME/events or whatever
9editor=${EDITOR:-vi} 9editor=${EDITOR:-vi}
10notify=${NOTIFY:-"notify push"}
10 11
11usage() { 12usage() {
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
24secondstoday() { 27secondstoday() {
@@ -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 ;;

Generated with cgit - Back to sebastiano.tronto.net