Documentation ¶
Index ¶
- Constants
- func NameBySpec(instance uint32) string
- type MenuStatus
- type Pixmap
- type TextDirection
- type ToolTip
- type Tray
- func (t *Tray) Close() error
- func (t *Tray) GetIconName() string
- func (t *Tray) SetAttentionIconName(name string) *Tray
- func (t *Tray) SetAttentionIconPixmap(src image.Image) *Tray
- func (t *Tray) SetAttentionMovieName(name string) *Tray
- func (t *Tray) SetCategory(cat sni.Category) *Tray
- func (t *Tray) SetIconName(name string) *Tray
- func (t *Tray) SetIconPixmap(src image.Image) *Tray
- func (t *Tray) SetIconPixmapRaw(pixmaps []Pixmap) *Tray
- func (t *Tray) SetId(id string) *Tray
- func (t *Tray) SetItemIsMenu(b bool) *Tray
- func (t *Tray) SetMenuIconThemePath(path []string) *Tray
- func (t *Tray) SetMenuPath(path dbus.ObjectPath) *Tray
- func (t *Tray) SetMenuServer(impl d_bus_menu.Dbusmenuer) *Tray
- func (t *Tray) SetMenuStatus(status MenuStatus) *Tray
- func (t *Tray) SetMenuTextDirection(dir TextDirection) *Tray
- func (t *Tray) SetOverlayIconName(name string) *Tray
- func (t *Tray) SetOverlayIconPixmap(src image.Image) *Tray
- func (t *Tray) SetOverlayIconPixmapRaw(pixmaps []Pixmap) *Tray
- func (t *Tray) SetSniServer(impl status_notifier_item.StatusNotifierItemer) *Tray
- func (t *Tray) SetSniStatus(status sni.Status) *Tray
- func (t *Tray) SetTitle(title string) *Tray
- func (t *Tray) SetToolTipRaw(tooltip ToolTip) *Tray
- func (t *Tray) SetWindowId(id int32) *Tray
- func (t *Tray) Setup() error
- func (t *Tray) SignalNewAttentionIcon() error
- func (t *Tray) SignalNewIcon() error
- func (t *Tray) SignalNewOverlayIcon() error
- func (t *Tray) SignalNewStatus() error
- func (t *Tray) SignalNewTitle() error
- func (t *Tray) SignalNewToolTip() error
Constants ¶
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 ¶
NameBySpec returns name in format defined in the spec. For example: org.kdeStatusNotifierItem-<process id>-<instance number>
Types ¶
type MenuStatus ¶
type MenuStatus = string
type TextDirection ¶
type TextDirection = 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 ¶
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 ¶
NewTray allocates new Tray. Note: this function doesn't communicate through dbus, to "start tray" you should call .Setup method
func (*Tray) GetIconName ¶
GetIconName returns StatusNotifierItem IconName property
func (*Tray) SetAttentionIconName ¶
SetAttentionIconName sets StatusNotifierItem AttentionIconName prop.
func (*Tray) SetAttentionIconPixmap ¶
SetAttentionIconPixmap sets StatusNotifierItem AttentionIconPixmap property. Copies src to a new image and changes pixel format to ARGB32.
Note: see SetOverlayIconPixmapRaw
func (*Tray) SetAttentionMovieName ¶
SetAttentionMovieName sets StatusNotifierItem AttentionMovieName prop.
func (*Tray) SetCategory ¶
SetCategory sets a category of the StatusNotifierItem. Default value is ApplicationStatus.
func (*Tray) SetIconName ¶
SetIconName sets StatusNotifierItem IconName property
func (*Tray) SetIconPixmap ¶
SetIconPixmap sets StatusNotifierItem IconPixmap property. Copies src to a new image and changes pixel format to ARGB32.
Note: see SetIconPixmapRaw
func (*Tray) SetIconPixmapRaw ¶
SetIconPixmapRaw sets StatusNotifierItem IconPixmap property.
Note: see SetIconPixmap for higher level abstraction
func (*Tray) SetId ¶
SetId sets an id that should be unique for this application and consistent between sessions, such as the application name itself.
func (*Tray) SetItemIsMenu ¶
SetItemIsMenu sets ItemIsMenu property
func (*Tray) SetMenuIconThemePath ¶
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 ¶
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 ¶
SetOverlayIconName is a property of StatusNotifierItem
func (*Tray) SetOverlayIconPixmap ¶
SetOverlayIconPixmap sets StatusNotifierItem OverlayIconPixmap property. Copies src to a new image and changes pixel format to ARGB32.
Note: see SetOverlayIconPixmapRaw
func (*Tray) SetOverlayIconPixmapRaw ¶
SetAttentionIconName sets StatusNotifierItem AttentionIconName prop.
func (*Tray) SetSniServer ¶
func (t *Tray) SetSniServer(impl status_notifier_item.StatusNotifierItemer) *Tray
func (*Tray) SetSniStatus ¶
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 ¶
SetTitle sets a name that describes the application, it can be more descriptive than Id.
func (*Tray) SetToolTipRaw ¶
SetToolTipRaw sets StatusNotifierItem ToolTip prop.
func (*Tray) SetWindowId ¶
SetWindowId sets WindowId property
func (*Tray) Setup ¶
Setup do necessary setups. Requests dbus name; exports servers; exports properties; registers with StatusNotifierWatcher; listens for OwnerNameChanged dbus signal etc.
func (*Tray) SignalNewAttentionIcon ¶
SignalNewAttentionIcon emits signal on dbus notifying system that attention icon was changed.
func (*Tray) SignalNewIcon ¶
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 ¶
SignalNewOverlayIcon emits signal on dbus notifying system that overlay icon was changed.
func (*Tray) SignalNewStatus ¶
SignalNewStatus emits signal on dbus notifying system that status was changed.
func (*Tray) SignalNewTitle ¶
SignalNewTitle emits signal on dbus notifying system that title was changed
func (*Tray) SignalNewToolTip ¶
SignalNewToolTip emits signal on dbus notifying system that tooltip was changed.