vendor/github.com/go-toast/toast/readme.md

61 lines · 1550 bytes

 1# Toast
 2
 3A go package for Windows 10 toast notifications.
 4
 5As seen in [jacobmarshall/pokevision-cli](https://github.com/jacobmarshall/pokevision-cli).
 6
 7## CLI
 8
 9As well as using go-toast within your Go projects, you can also utilise the CLI - for any of your projects.
10
11Download [64bit](https://go-toast-downloads.s3.amazonaws.com/v1/toast64.exe) or [32bit](https://go-toast-downloads.s3.amazonaws.com/v1/toast32.exe)
12
13```cmd
14C:\Users\Example\Downloads\toast64.exe \
15  --app-id "Example App" \
16  --title "Hello World" \
17  --message "Lorem ipsum dolor sit amet, consectetur adipiscing elit." \
18  --icon "C:\Users\Example\Pictures\icon.png" \
19  --audio "default" --loop \
20  --duration "long" \
21  --activation-arg "https://google.com" \
22  --action "Open maps" --action-arg "bingmaps:?q=sushi" \
23  --action "Open browser" --action-arg "http://..."
24```
25
26![CLI](./screenshot-cli.png)
27
28## Example
29
30```go
31package main
32
33import (
34    "log"
35
36    "gopkg.in/toast.v1"
37)
38
39func main() {
40    notification := toast.Notification{
41        AppID: "Example App",
42        Title: "My notification",
43        Message: "Some message about how important something is...",
44        Icon: "go.png", // This file must exist (remove this line if it doesn't)
45        Actions: []toast.Action{
46            {"protocol", "I'm a button", ""},
47            {"protocol", "Me too!", ""},
48        },
49    }
50    err := notification.Push()
51    if err != nil {
52        log.Fatalln(err)
53    }
54}
55```
56
57## Screenshots
58
59![Toast](./screenshot-toast.png)
60
61![Action centre](./screenshot-action-centre.png)