sni

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 6 Imported by: 0

README

go-sni: Go implementation of Freedesktop.org StatusNotifierItem specification

Go Reference

This is the client implementation of the Freedesktop.org StatusNotifierItem specification. This can be used to display icons in the system tray.

API

See the API Reference.

Example

See the example in the example/ dir.

Documentation

Overview

Package sni implements the Freedesktop.org StatusNotifierItem specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Icon

type Icon struct {
	Name    string
	Pixmaps []Pixmap
}

type Item

type Item struct {

	// Caled when activation is requested for the item (e.g. clicked)
	Activate func(x, y int)

	// Called when secondary activation is requested for the item (e.g. middle-click)
	SecondaryActivate func(x, y int)

	// Called when a context menu is requested for the item (e.g. right-click)
	ContextMenu func(x, y int)

	// Called when scroll is requested for the item (e.g. scroll wheel)
	Scroll func(delta int, direction string)
	// contains filtered or unexported fields
}

func NewItem

func NewItem(conf ItemConfig) (*Item, error)

func (*Item) Close

func (sni *Item) Close() error

func (*Item) SetAttentionIcon

func (sni *Item) SetAttentionIcon(icon Icon) error

func (*Item) SetIcon

func (sni *Item) SetIcon(icon Icon) error

func (*Item) SetOverlayIcon

func (sni *Item) SetOverlayIcon(icon Icon) error

func (*Item) SetStatus

func (sni *Item) SetStatus(status string) error

func (*Item) SetTitle

func (sni *Item) SetTitle(t string) error

func (*Item) SetTooltip

func (sni *Item) SetTooltip(tooltip Tooltip) error

type ItemConfig

type ItemConfig struct {
	Category      string
	ID            string
	Title         string
	Status        string
	Icon          Icon
	OverlayIcon   Icon
	AttentionIcon Icon
	Tooltip       Tooltip
}

See https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/ for details of tese fields

type Pixmap

type Pixmap struct {
	Width  int
	Height int
	Data   []byte
}

func ImagePixmap

func ImagePixmap(img image.Image) Pixmap

type Tooltip

type Tooltip struct {
	Icon  Icon
	Title string
	Text  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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