Exemple #1
0
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()
}
Exemple #2
0
func init() {
	notify.Init("IRC-noti")

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, os.Kill)
	go func() {
		for sig := range c {
			// sig is a ^C, handle it
			log.Printf("captured %v, stopping profiler and exiting..", sig)
			notify.UnInit()
			os.Exit(0)
		}
	}()
}
Exemple #3
0
func cleanExit(sigVal os.Signal) {
	fmt.Printf("Exiting with signal: %v\n", sigVal)
	notify.UnInit()
	os.Exit(0)
}