summaryrefslogtreecommitdiff
path: root/arch/scripts/.local/bin/!remindme
blob: 35b817fe1ffe4312f528d342adae2f5dfffe4d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash

parse_time() {
    local input="${1,}"

    if [[ $input =~ ^([0-9]+)(m|min|mins|minute|minutes)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} minutes"
    elif [[ $input =~ ^([0-9]+)(h|hr|hrs|hour|hours)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} hours"
    elif [[ $input =~ ^([0-9]+)(d|day|days)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} days"
    elif [[ $input =~ ^([0-9]+)(w|wk|wks|week|weeks)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} weeks"
    elif [[ $input =~ ^([0-9]+)(mo|month|months)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} months"
    elif [[ $input =~ ^([0-9]+)(y|yr|yrs|year|years)$ ]]; then
        echo "now + ${BASH_REMATCH[1]} years"
    else
        echo "$input"
    fi
}

AT_TIME=$(parse_time "$2")
at "$AT_TIME" <<EOF
notify-send "$1"
ffplay -autoexit -nodisp -f lavfi -i "sine=f=880:d=0.6,adelay=450|0[a]; sine=f=1320:d=0.6[b]; [a][b]amix=inputs=2,afade=t=in:d=0.05,afade=t=out:st=0.35:d=0.5"
EOF