From 9bb7021787b968d61b2ca7e93460f9de257a6113 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Oct 2022 18:18:32 -0500 Subject: [PATCH] INIT: initial commit --- .gitignore | 2 ++ Makefile | 10 ++++++++++ main.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 main.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2992c9d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +go.* +go-notify-helloworld diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e44c345 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +# init the go mod files +init: + go mod init go-notify-helloworld + go mod tidy + +build: + go build + +run: + ./go-notify-helloworld diff --git a/main.go b/main.go new file mode 100644 index 0000000..2174a26 --- /dev/null +++ b/main.go @@ -0,0 +1,43 @@ +/* + * main.go for go-notify + * by lenorm_f + */ + +package main + +import notify "github.com/mqu/go-notify" +import ( + "os" + "fmt" + "time" +) + +const ( + DELAY = 3000; +) + +func main() { + notify.Init("Hello World!") + hello := notify.NotificationNew("Hello World!", + "This is an example notification.", + "") + + if hello == nil { + fmt.Fprintf(os.Stderr, "Unable to create a new notification\n") + return + } + // hello.SetTimeout(3000) + notify.NotificationSetTimeout(hello, DELAY) + + // hello.Show() + if e := notify.NotificationShow(hello); e != nil { + fmt.Fprintf(os.Stderr, "%s\n", e.Message()) + return + } + + time.Sleep(DELAY * 1000000) + // hello.Close() + notify.NotificationClose(hello) + + notify.UnInit() +}