INIT: initial commit

This commit is contained in:
Jeff Carr 2022-10-07 18:18:32 -05:00
commit 9bb7021787
3 changed files with 55 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
go.*
go-notify-helloworld

10
Makefile Normal file
View File

@ -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

43
main.go Normal file
View File

@ -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()
}