From e414682209bc706fdddbffc02a21f8526caa8b38 Mon Sep 17 00:00:00 2001 From: Lucas F Date: Thu, 19 Oct 2023 18:59:51 -0300 Subject: [PATCH] initial --- README.md | 21 +++++++- beep.mp3 | Bin 0 -> 9912 bytes clock.svg | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 31 +++++++++++ remind | 64 +++++++++++++++++++++++ 5 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 beep.mp3 create mode 100644 clock.svg create mode 100644 install.sh create mode 100755 remind diff --git a/README.md b/README.md index 21597f2..57c8155 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,20 @@ -# remind +# Remind -A simple bash script to remind something by stipulated time. \ No newline at end of file +A simple bash script to remind something by stipulated time. + +## Install + +```bash +sh <(curl -s https://git.lucasf.dev/public/remind/raw/branch/master/install.sh) +``` + +## Usage + +Example of usage: + +```bash +remind do something cool +> Time to delay: 15m +``` + +The time can be (s|m|h) diff --git a/beep.mp3 b/beep.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0d51ac87ff48479658d5ff6d66d06b6460376c09 GIT binary patch literal 9912 zcmZ8ncRbX8{J-OH&f##jID2Q8Rn9(pE6OTcg{;)K?u@gtH)Zdclm<#6QIuIJB4vv* zl6CLj=lcEgd;DIHhkL*8bC1XKHQulJ_5oY5p0NK&Z zth~H9oQ#Z$ik6nXzOk{nxs8pZ-PqWtPt((LbBl|stG|Bj?Ck9w9RY|S9vbGl7KSRvH8if$ zT!FsAj^kl4tdSV4zalf~*zA+C2s z+tm7p4d`U~(0jK8z%0r>m$%@0_Cz{TYL;k(X$U{?lC zHkvijmLVR_7Qc95h@oNPSn&oIKJlEr2G`SnWd%SL09)I24|*zohH^T3%s}QcWvy!`gJe+Z z$Ix{+jELvuu%eXbv#_gNKB&CIAwd^xLNB26@-2tgJ+MtG#kc-m1VEiJfqoK;W1qhK z=rc024auiRYdUikRi=x#p~GFvyzt+r`V&}J6@L96`h||H0B7R&_=!grUX@)g z??g^Vv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=>`*kwtsdiJLZjkKTW!%ufhh{OB{O-z>7{Mwg^k>$_6ZCq-V7`! zyPa-mW((}dK(vFdpX&g}N#r5DN!;# zI(qCF^jtHQ50!c53^W`-R*{8{79z^)MCh}{iB!Z1iyX-wn?HSugHN4eH#2sT|@^xKPshiF0OM04Pg9IBhwlRDXaY zr`~b}AeQqv{0h~wd8=^VQ?Ted?BF@CcR`(JH_Ghns{9evrDw z%8)bzs+{}v%6M6fi4S=?C^G=eiq3#}pOdfI@L$GoFg!c&-XEt)AGt?PUTGK0(!aB) zXXyD`hNRMBPWR$aiHYS`22@rg zKzfr&JTy23av_t?M1}9`;iUukWBKK3YYDLBX~2y%ltf=gOKP%y%azY&a=^nj4u8Y> zD05ehPIpzwn=ITn5QJ_Q)_g*`EJ2wOwEeXV`7N7s$cfOFtbTOr^-P$=|vdb z{B4Oej8VXTain@Q&CA})Zb?+Ib4A#RV zRv4wZ1T@YMDWp@+9m7Z%qKDC~l(P*KVnmqU8LbN1P4jDI}W zduU8N3PTc*B}2ywH?MMlg>S9{ + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8c6690b --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +main() { + local SOUNDDIR="$HOME/.local/share/sounds" + local ICONDIR="$HOME/.local/share/icons" + local CMDDIR="$HOME/.local/bin/" + + + if [[ ! -d "./remind" ]]; then + git clone https://git.lucasf.dev/public/remind > /dev/null 2>&1 + if [[ ! -d "$SOUNDDIR" ]]; then + mkdir -p "$SOUNDDIR" + fi + if [[ ! -d "$ICONDIR" ]]; then + mkdir -p "$ICONDIR" + fi + mv $(pwd)/remind/remind $CMDDIR + mv $(pwd)/remind/clock.svg $ICONDIR + mv $(pwd)/remind/beep.mp3 $SOUNDDIR + rm -rf $(pwd)/remind + else + echo -e "\033[31m[error]\nRemove the remind folder first.\n\033[0m" + exit 1 + fi + +} + +main +if [[ $? -eq 0 ]];then echo "Remind installed"; fi + +# vim: ft=bash:ts=4:sts=4:sw=4 diff --git a/remind b/remind new file mode 100755 index 0000000..1f73911 --- /dev/null +++ b/remind @@ -0,0 +1,64 @@ +#!/bin/bash + + +CMD="cancel" +SOUND_LOCATION="$HOME/.local/share/sounds" +ICON_LOCATION="$HOME/.local/share/icons/clock.svg" + +_execute() { + if [[ $TIMECHOOSEN =~ ^[1-9]?[0-9](s|m|h)$ ]]; then + sleep $TIMECHOOSEN + notify-send -i $ICON_LOCATION "Reminder" "$MSG" + ffplay -nodisp -autoexit -hide_banner -loglevel error $SOUND_LOCATION/beep.mp3 + else + echo -e "\033[31m[error]\nThe time must be provided as the example: 10(s|m|h).\n\033[0m" + fi +} + +_parse() { + if [[ $@ == "$CMD" ]]; then + _pre_cancel + else + _remind $@ + fi +} + +_remind() { + MSG="$@" + + if [[ -z "$@" ]]; then + echo -e "\033[31m[error]\nProvide a remind text first.\n\033[0m" + else + read -p 'Time to delay: ' TIMECHOOSEN + if [[ -z "$TIMECHOOSEN" ]]; then + echo -e "\033[31m[error]\nProvide a time.\n\033[0m" + else + _execute $@ $TIMECHOOSEN & + fi + fi +} + +_pre_cancel() { + NUMOFLINES=$(pgrep -a remind | wc -l) + if [[ $NUMOFLINES -le 2 ]]; then + echo "No reminders to cancel" + else + _cancel + fi +} + +_cancel() { + pgrep -a remind | awk -F "remind" -v nl="$NUMOFLINES" '{ if (NR < (nl - 1)) { print "[" NR "]" $NF}}' + read -p "Please choose a number to cancel [1-$(($NUMOFLINES - 2))]: " CHOOSE + if [[ $CHOOSE =~ ^[1-9]?[0-9] ]]; then + if [[ $CHOOSE -le $(($NUMOFLINES - 2)) ]]; then + kill $(pgrep -a remind | awk -F " " -v op="$CHOOSE" '{ if (NR == op) { print $1}}') + else + echo -e "\033[31m[error]\nInvalid option.\n\033[0m" + fi + else + echo -e "\033[31m[error]\nInvalid option.\n\033[0m" + fi +} + +_parse $@