From ca20b2a052ab17552adc68316450d3efe943d634 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:26:43 -0600 Subject: [PATCH] gr --- main.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 4869c33..ca62ada 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,6 @@ import ( "time" "github.com/gen2brain/beeep" - "github.com/schollz/progressbar/v3" ) func main() { @@ -74,24 +73,22 @@ func alertAfter(ctx context.Context, ntfy string, duration string) error { } func alertAt(ctx context.Context, ntfy string, deadline time.Time, title, msg string) error { - n := int64(time.Until(deadline) / time.Second) - bar := progressbar.Default(n) + // n := int64(time.Until(deadline) / time.Second) c := time.NewTicker(time.Second) defer c.Stop() func() { ctx, can := context.WithDeadline(ctx, deadline) defer can() - for { + for ctx.Err() == nil { select { case <-c.C: case <-ctx.Done(): return } - bar.Add(1) + fmt.Printf("\r%s ", deadline.Sub(time.Now())) } }() - bar.Finish() - bar.Exit() + fmt.Println() if err := ctx.Err(); err == nil { beeep.Alert(title, msg, "/dev/null")