package
module
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Nov 17, 2021
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 7
Opens a new window with list of known importers.
README
¶
Golang-Toast

cross-platform library for sending desktop notifications
Installation
go get github.com/electricbubble/go-toast
Example
-
Common invocation
package main
import (
"github.com/electricbubble/go-toast"
)
func main() {
// _ = toast.Push("test message")
_ = toast.Push("test message", toast.WithTitle("app title"))
}
-
macOS
package main
import (
"github.com/electricbubble/go-toast"
)
func main() {
// _ = toast.Push("test message")
// _ = toast.Push("test message", toast.WithTitle("app title"))
_ = toast.Push("test message",
toast.WithTitle("app title"),
toast.WithSubtitle("app sub title"),
toast.WithAudio(toast.Ping),
// toast.WithObjectiveC(true),
)
}
-
Windows
package main
import (
"github.com/electricbubble/go-toast"
)
func main() {
// _ = toast.Push("test message")
// _ = toast.Push("test message", toast.WithTitle("app title"))
_ = toast.Push("test message",
toast.WithTitle("app title"),
toast.WithAppID("app id"),
toast.WithAudio(toast.Default),
toast.WithLongDuration(),
toast.WithIcon("/path/icon.png"),
)
// bs, err := os.ReadFile("/path/icon.png")
// if err != nil {
// log.Fatalln(err)
// }
// toast.WithIconRaw(bs)
}
-
js && wasm
package main
import (
"fmt"
"github.com/electricbubble/go-toast"
)
func main() {
// _ = toast.Push("test message")
// _ = toast.Push("test message", toast.WithTitle("app title"))
_ = toast.Push("test_message",
toast.WithTitle("GO-WASM-APP"),
toast.WithOnClick(func(event interface{}) {
fmt.Println("click")
}),
toast.WithOnClose(func() {
fmt.Println("close")
}),
toast.WithOnShow(func() {
fmt.Println("show")
}),
)
}
Thanks
Thank you JetBrains for providing free open source licenses
Documentation
¶
type NotificationOption func(*notification)
WithAudio
The audio to play when displaying the notification
WithMessage
The single/multi line message to display for the notification.
WithTitle
The main title/heading for the notification.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.