tray

package
v0.0.0-...-ecb45ff Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MENU_PATH = "/MenuBar"
	SNI_PATH  = "/StatusNotifierItem"
	// SNI_INTERFACE_NAME stands for StatusNotifierItem
	SNI_INTERFACE_NAME = "org.kde.StatusNotifierItem"
	// SNW_INTERFACE_NAME stands for StatusNotifierWatcher
	SNW_INTERFACE_NAME      = "org.kde.StatusNotifierWatcher"
	DBUSMENU_INTERFACE_NAME = "com.canonical.dbusmenu"

	// TextDirectionLTR stands for left to right
	TextDirectionLTR TextDirection = "ltr"
	// TextDirectionRTL stands for right to left
	TextDirectionRTL TextDirection = "rtl"

	// MenuStatusNormal would be right to use in almost all cases
	MenuStatusNormal MenuStatus = "normal"
	// MenuStatusNotice is used to indicate higher priority then normal
	MenuStatusNotice MenuStatus = "notice"
)

Variables

This section is empty.

Functions

func NameBySpec

func NameBySpec(instance uint32) string

NameBySpec returns name in format defined in the spec. For example: org.kdeStatusNotifierItem-<process id>-<instance number>

Types

type MenuStatus = string

type Pixmap

type Pixmap struct {
	Width  int32
	Heigth int32
	// Data is represented in ARGB32 format and is in the network byte order
	Data []byte
}

type TextDirection

type TextDirection = string

type ToolTip

type ToolTip struct {
	First  string
	Second []struct {
		First  int32
		Second int32
		Third  []byte
	}
	Third  string
	Fourth string
}

type Tray

type Tray struct {
	// contains filtered or unexported fields
}

Tray is trying to abstract tray functionality into one place.

It's not safe to call methods from multiple goroutines simultaneously without synchronysation.

func NewTray

func NewTray(id, title string, itemTree menu.ItemTree) (*Tray, error)

NewTray allocates new Tray. Note: this function doesn't communicate through dbus, to "start tray" you should call .Setup method.

Returns error if it couldn't establish connection to dbus session bus.

func NewTrayWithConn

func NewTrayWithConn(conn *dbus.Conn, id, title string, itemTree menu.ItemTree) *Tray

NewTray allocates new Tray. Note: this function doesn't communicate through dbus, to "start tray" you should call .Setup method

func (*Tray) Close

func (t *Tray) Close() error

Close closes underlying dbus connection

func (*Tray) GetIconName

func (t *Tray) GetIconName() string

GetIconName returns StatusNotifierItem IconName property

func (*Tray) SetAttentionIconName

func (t *Tray) SetAttentionIconName(name string) *Tray

SetAttentionIconName sets StatusNotifierItem AttentionIconName prop.

func (*Tray) SetAttentionIconPixmap

func (t *Tray) SetAttentionIconPixmap(src image.Image) *Tray

SetAttentionIconPixmap sets StatusNotifierItem AttentionIconPixmap property. Copies src to a new image and changes pixel format to ARGB32.

Note: see SetOverlayIconPixmapRaw

func (*Tray) SetAttentionMovieName

func (t *Tray) SetAttentionMovieName(name string) *Tray

SetAttentionMovieName sets StatusNotifierItem AttentionMovieName prop.

func (*Tray) SetCategory

func (t *Tray) SetCategory(cat sni.Category) *Tray

SetCategory sets a category of the StatusNotifierItem. Default value is ApplicationStatus.

func (*Tray) SetIconName

func (t *Tray) SetIconName(name string) *Tray

SetIconName sets StatusNotifierItem IconName property

func (*Tray) SetIconPixmap

func (t *Tray) SetIconPixmap(src image.Image) *Tray

SetIconPixmap sets StatusNotifierItem IconPixmap property. Copies src to a new image and changes pixel format to ARGB32.

Note: see SetIconPixmapRaw

func (*Tray) SetIconPixmapRaw

func (t *Tray) SetIconPixmapRaw(pixmaps []Pixmap) *Tray

SetIconPixmapRaw sets StatusNotifierItem IconPixmap property.

Note: see SetIconPixmap for higher level abstraction

func (*Tray) SetId

func (t *Tray) SetId(id string) *Tray

SetId sets an id that should be unique for this application and consistent between sessions, such as the application name itself.

func (*Tray) SetItemIsMenu

func (t *Tray) SetItemIsMenu(b bool) *Tray

SetItemIsMenu sets ItemIsMenu property

func (*Tray) SetMenuIconThemePath

func (t *Tray) SetMenuIconThemePath(path []string) *Tray

A list of directories that should be used for finding icons using the icon naming spec. Ideally there should only be one for the icon theme, but additional ones are often added by applications for app specific icons.

func (*Tray) SetMenuPath

func (t *Tray) SetMenuPath(path dbus.ObjectPath) *Tray

SetMenuPath sets a path to a menu.

You shouldn't use this function if you don't know what it is.

func (*Tray) SetMenuServer

func (t *Tray) SetMenuServer(impl d_bus_menu.Dbusmenuer) *Tray

func (*Tray) SetMenuStatus

func (t *Tray) SetMenuStatus(status MenuStatus) *Tray

Tells if the menus are in a normal state or they believe that they could use some attention. Cases for showing them would be if help were referring to them or they accessors were being highlighted. This property can have two values:

- "normal" in almost all cases and

- "notice" when they should have a higher priority to be shown.

func (*Tray) SetMenuTextDirection

func (t *Tray) SetMenuTextDirection(dir TextDirection) *Tray

Represents the way the text direction of the application. This allows the server to handle mismatches intelligently. For left- to-right the string is "ltr" for right-to-left it is "rtl".

func (*Tray) SetOverlayIconName

func (t *Tray) SetOverlayIconName(name string) *Tray

SetOverlayIconName is a property of StatusNotifierItem

func (*Tray) SetOverlayIconPixmap

func (t *Tray) SetOverlayIconPixmap(src image.Image) *Tray

SetOverlayIconPixmap sets StatusNotifierItem OverlayIconPixmap property. Copies src to a new image and changes pixel format to ARGB32.

Note: see SetOverlayIconPixmapRaw

func (*Tray) SetOverlayIconPixmapRaw

func (t *Tray) SetOverlayIconPixmapRaw(pixmaps []Pixmap) *Tray

SetAttentionIconName sets StatusNotifierItem AttentionIconName prop.

func (*Tray) SetSniServer

func (t *Tray) SetSniServer(impl status_notifier_item.StatusNotifierItemer) *Tray

func (*Tray) SetSniStatus

func (t *Tray) SetSniStatus(status sni.Status) *Tray

SetSniStatus sets StatusNotifierItem Status property.

It describes the status of this item or of the associated application.

The allowed values for the Status property are:

Passive: The item doesn't convey important information to the user, it can be considered an "idle" status and is likely that visualizations will chose to hide it.

Active: The item is active, is more important that the item will be shown in some way to the user.

NeedsAttention: The item carries really important information for the user, such as battery charge running out and is wants to incentive the direct user intervention. Visualizations should emphasize in some way the items with NeedsAttention status.

func (*Tray) SetTitle

func (t *Tray) SetTitle(title string) *Tray

SetTitle sets a name that describes the application, it can be more descriptive than Id.

func (*Tray) SetToolTipRaw

func (t *Tray) SetToolTipRaw(tooltip ToolTip) *Tray

SetToolTipRaw sets StatusNotifierItem ToolTip prop.

func (*Tray) SetWindowId

func (t *Tray) SetWindowId(id int32) *Tray

SetWindowId sets WindowId property

func (*Tray) Setup

func (t *Tray) Setup() error

Setup do necessary setups. Requests dbus name; exports servers; exports properties; registers with StatusNotifierWatcher; listens for OwnerNameChanged dbus signal etc.

func (*Tray) SignalNewAttentionIcon

func (t *Tray) SignalNewAttentionIcon() error

SignalNewAttentionIcon emits signal on dbus notifying system that attention icon was changed.

func (*Tray) SignalNewIcon

func (t *Tray) SignalNewIcon() error

SignalNewIcon emits signal on dbus thus requesting re-rendering of its icon. You should emit this signal to reflect change of the icon visually.

func (*Tray) SignalNewOverlayIcon

func (t *Tray) SignalNewOverlayIcon() error

SignalNewOverlayIcon emits signal on dbus notifying system that overlay icon was changed.

func (*Tray) SignalNewStatus

func (t *Tray) SignalNewStatus() error

SignalNewStatus emits signal on dbus notifying system that status was changed.

func (*Tray) SignalNewTitle

func (t *Tray) SignalNewTitle() error

SignalNewTitle emits signal on dbus notifying system that title was changed

func (*Tray) SignalNewToolTip

func (t *Tray) SignalNewToolTip() error

SignalNewToolTip emits signal on dbus notifying system that tooltip was changed.

Jump to

Keyboard shortcuts

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