dots


dots / config / .local / bin
xxwhirlpool  ·  2026-03-18

nag

 1#!/usr/bin/env bash
 2
 3if [[ $# -eq 0 ]]; then
 4	echo "Usage: nag [MINUTES]"
 5	exit 1
 6fi
 7
 8NUM="$1"
 9
10if [[ ! $NUM =~ ^[0-9]+$ ]]; then
11	echo "duration cannot be a decimal"
12	exit 1
13fi
14
15DURATION=$(( "$NUM" * 60 ))
16DURATION_M=$(( "$DURATION"/60%60 ))
17MSG="it's been $DURATION_M minutes"
18
19notif() {
20	notify-send "$MSG" && sleep 1 && spd-say -t female3 "$MSG"
21}
22
23logic() {
24	notify-send "you'll get a reminder every $DURATION_M minutes"
25	sleep "$DURATION" && notif
26}
27
28logic