Skip to content

nathan-osman/go-wintray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-wintray

Go Reference MIT License

A simple package for creating an icon in the system tray and displaying notifications.

Usage

To use this package, begin by importing it:

import "github.com/nathan-osman/go-wintray"

Next, create the tray icon:

w := wintray.New()
defer w.Close()

You will likely want to set an icon and tooltip:

//go:embed myapp.ico
var b []byte

w.SetIconFromBytes(b)
w.SetTip("MyApp Is Running")

You can add items to the context menu that is shown when the icon is right-clicked:

w.AddMenuItem("&Print Message", func() {
    fmt.Println("This is a tooltip!")
})

Note that the provided function will run on a different goroutine than the caller.

Screenshot of example code running in the system tray

Notifications can be displayed as well:

w.ShowNotification("This is a test.", "Title")

About

Package for creating an icon in the system tray and managing notifications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages