tray

package module
v0.0.0-...-f8aaa44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

README

Tray

A cross-platform tray for Go.

Platform implement status

  • Windows
  • Linux
  • Darwin

Usage

git clone github.com/shadowv/tray
cd tray

Linux

cd example
go run .

Windows

Run example with

go get github.com/akavel/rsrc
cd example
rsrc -manifest main.exe.manifest -arch amd64 -o rsrc.syso
go run .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item interface {
	Checked() bool
	SetIcon(img string) error
	SetTitle(title string) error
	SetEnabled(enabled bool) error
	SetVisible(visible bool) error
	SetChecked(checked bool) error
	SetCallback(callback func()) error
	AddItem(option ItemOption) (Item, error)
	AddItems(options ...ItemOption) ([]Item, error)
}

type ItemOption

type ItemOption struct {
	Icon      string
	Title     string
	Disabled  bool
	Checkable bool
	Checked   bool
	Invisible bool
	Callback  func() // On Linux, callback() when submenu is selected
	Children  []ItemOption
}

type Tray

type Tray interface {
	Run()
	SetIcon(icon string) error
	SetTitle(title string) error // not supported on Windows
	SetToolTip(toolTip string) error
	SetVisible(visible bool) error
	SetLeftClickCallback(callback func()) error  // not supported on Linux
	SetRightClickCallback(callback func()) error // not supported on Linux
	AddItem(option ItemOption) (Item, error)
	AddItems(options ...ItemOption) ([]Item, error)
	Close() error
}

func NewTray

func NewTray(option TrayOption) (Tray, error)

type TrayOption

type TrayOption struct {
	Icon               string
	Title              string // not supported on Windows
	ToolTip            string
	Invisible          bool
	LeftClickCallback  func() // not supported on Linux
	RightClickCallback func() // not supported on Linux
	Children           []ItemOption
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL