commit 6e67733fe218f9b10d129052c8d8d552437dbafc
parent 82c3b5df8d55d2a59a42853a1bb4203bf0648bf8
Author: jacobsGit <JacobDoesLinux@protonmail.com>
Date: Wed, 1 Jan 2020 15:06:59 -0800
reminder script, notification, stdout, and wall
Diffstat:
1 file changed, 76 insertions(+), 0 deletions(-)
diff --git a/xmobar/.xmobar/xmb-reminders b/xmobar/.xmobar/xmb-reminders
@@ -0,0 +1,76 @@
+#!/bin/sh
+# 01/01/2020 - Jacob Edwards
+
+# created to for new years resolutions, prints to stdout, sends a notification, and sends message via wall
+# it is very messy due but i THINK it works
+
+# also it counts the start of a new day at 5:00 AM. so if you get up before then
+# change line 42* from 500 to another time
+
+# as far as what to put in reminder-daemon `config` the syntax is as follows (TIME is in `date +%R' format)
+# [TIME] [TIME] >> this is the message that will be sent
+
+
+
+
+if [[ ! -e "$HOME/.cache/reminders" ]]; then
+ mkdir "$HOME/.cache/reminders"
+ touch "$HOME/.cache/reminders/reminded"
+fi
+
+config="$XDG_CONFIG_HOME/reminders"
+done="$HOME/.cache/reminders/reminded"
+date="$(date +%_j)"
+
+
+
+sed -i -n "/^$date/p" "$done"
+time="$(date '+%R' | sed 's/://g')"
+
+
+
+
+let i=0
+while [[ "$(wc -l "$config" | awk '{print $1}')" -gt "$i" ]]; do
+ let i++
+
+ configline="$(head -n "$i" "$config" | tail -n 1)"
+ timestart="$(printf "$configline" | awk '{print $1}' | sed 's/://g' )"
+ timeend="$( printf "$configline" | awk '{print $2}' | sed 's/://g' )"
+ message="$( printf "$configline" | awk -F '>>' '{print $2}')"
+
+ if [[ "$timeend" -lt 500 ]]; then
+ let timeend=timeend+timestart
+ let date2="$(expr "$date" + 1)"
+ # i stay up late and get up late. i'll come up with a better solution later
+ fi
+
+ if [[ "$time" -gt "$timestart" ]] && [[ "$time" -lt "$timeend" ]]; then
+ let a=0
+
+ while [[ "$(wc -l "$done" | awk '{print $1}')" -gt "$a" ]]; do
+ let a++
+
+ if [[ "$(head -n "$a" "$done" | tail -n 1)" == "$date $message" ]]; then
+ send=false
+ fi
+ done
+
+ if [[ "$send" != 'false' ]]; then
+ notify-send -t 30000 "$message"
+ wall "$message" -t 30
+ printf "$message\n"
+ printf "$date $message\n" >> "$done"
+ if [[ -n "$date2" ]]; then
+ printf "$date2 $message\n" >> "$done"
+ fi
+
+ notified=true
+ fi
+ fi
+done
+
+
+if [[ "$notified" != 'true' ]]; then
+ printf ''
+fi