godock: github.com/sqp/godock/libs/appdbus Index | Files

package appdbus

import "github.com/sqp/godock/libs/appdbus"

Package appdbus is the godock cairo-dock connector using DBus.

Its goal is to connect the cairo-dock applet to its parent, the dock, send actions, and forward events through the backend.

Index

Package Files

appdbus.go

func New Uses

func New(callnew cdtype.NewAppletFunc, args []string, dir string) (cdtype.AppInstance, *CDDbus, func() error)

New creates a new applet instance with args from command line.

func StandAlone Uses

func StandAlone(callnew cdtype.NewAppletFunc)

StandAlone will create, prepare and launch a standalone cairo-dock applet.

If you set your events at creation, they will respond when needed, and you have nothing more to worry about your applet management.

It can handle only one poller for now.

If a fatal error is received during one of those steps, the applet will not be started and errors should be logged. Can't do much more about it.

type CDDbus Uses

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

CDDbus is an applet connection to Cairo-Dock using Dbus.

func (*CDDbus) AddMenuItems Uses

func (cda *CDDbus) AddMenuItems(items ...map[string]interface{}) error

AddMenuItems adds a list of items to the menu triggered by OnBuildMenu.

func (*CDDbus) AddSubIcon Uses

func (cda *CDDbus) AddSubIcon(fields ...string) error

AddSubIcon adds subicons by pack of 3 strings : label, icon, id.

func (*CDDbus) Animate Uses

func (cda *CDDbus) Animate(animation string, rounds int) error

Animate animates the icon for a given number of rounds.

func (*CDDbus) BindShortkey Uses

func (cda *CDDbus) BindShortkey(shortkeys ...*cdtype.Shortkey) error

BindShortkey binds one or more keyboard shortcuts to your applet.

func (*CDDbus) ConnectEvents Uses

func (cda *CDDbus) ConnectEvents(conn *dbus.Conn) (e error)

ConnectEvents registers to receive Dbus applet events.

func (*CDDbus) ConnectToBus Uses

func (cda *CDDbus) ConnectToBus() (<-chan *dbus.Signal, error)

ConnectToBus connects the applet manager to the dock and register events callbacks.

func (*CDDbus) DataRenderer Uses

func (cda *CDDbus) DataRenderer() cdtype.IconRenderer

DataRenderer manages the graphic data renderer of the icon.

func (*CDDbus) DemandsAttention Uses

func (cda *CDDbus) DemandsAttention(start bool, animation string) error

DemandsAttention is an endless Animate method.

func (*CDDbus) IconProperties Uses

func (cda *CDDbus) IconProperties() (cdtype.IconProperties, error)

IconProperties returns all applet icon properties at once.

func (*CDDbus) IconProperty Uses

func (cda *CDDbus) IconProperty() cdtype.IconProperty

IconProperty returns applet icon properties one by one.

func (*CDDbus) OnSignal Uses

func (cda *CDDbus) OnSignal(s *dbus.Signal) (exit bool)

OnSignal forward the received signal to the registered event callback. Return true if the signal was quit applet.

func (*CDDbus) PopupDialog Uses

func (cda *CDDbus) PopupDialog(data cdtype.DialogData) error

PopupDialog open a dialog box . See cdtype.AppIcon.

func (*CDDbus) RemoveSubIcon Uses

func (cda *CDDbus) RemoveSubIcon(id string) error

RemoveSubIcon only need the ID to remove the SubIcon.

func (*CDDbus) RemoveSubIcons Uses

func (cda *CDDbus) RemoveSubIcons() error

RemoveSubIcons removes all subicons from the applet. (To be called in init).

func (*CDDbus) SetEmblem Uses

func (cda *CDDbus) SetEmblem(icon string, position cdtype.EmblemPosition) error

SetEmblem set an emblem image on the icon. To remove it, you have to use SetEmblem again with an empty string.

func (*CDDbus) SetIcon Uses

func (cda *CDDbus) SetIcon(icon string) error

SetIcon set the image of the icon, overwriting the previous one.

func (*CDDbus) SetLabel Uses

func (cda *CDDbus) SetLabel(label string) error

SetLabel change the text label next to the icon.

func (*CDDbus) SetOnEvent Uses

func (cda *CDDbus) SetOnEvent(onEvent func(string, ...interface{}) bool)

SetOnEvent sets the OnEvent callback to forwards events.

func (*CDDbus) SetQuickInfo Uses

func (cda *CDDbus) SetQuickInfo(info string) error

SetQuickInfo change the quickinfo text displayed on the icon.

func (*CDDbus) ShowDialog Uses

func (cda *CDDbus) ShowDialog(message string, duration int) error

ShowDialog pops up a simple dialog bubble on the icon.

func (*CDDbus) SubIcon Uses

func (cda *CDDbus) SubIcon(key string) cdtype.IconBase

SubIcon returns the subicon object matching the given key.

func (*CDDbus) Window Uses

func (cda *CDDbus) Window() cdtype.IconWindow

Window gives access to actions on the controlled window.

type Menu struct {
    *MenuData
    MenuID int32
}

Menu is a menu builder, storing callbacks at creation to be sure the answer match the user request.

func (menu *Menu) AddCheckEntry(label string, active bool, call interface{}, userData ...interface{}) cdtype.MenuWidgeter

AddCheckEntry adds a check entry to the menu.

func (menu *Menu) AddEntry(label, iconPath string, call interface{}, userData ...interface{}) cdtype.MenuWidgeter

AddEntry adds an item to the menu with its callback.

func (menu *Menu) AddRadioEntry(label string, active bool, group int, call interface{}, userData ...interface{}) cdtype.MenuWidgeter

AddRadioEntry adds a radio entry to the menu.

func (menu *Menu) AddSeparator()

AddSeparator adds a separator to the menu.

func (menu *Menu) AddSubMenu(label, iconPath string) cdtype.Menuer

AddSubMenu adds a submenu to the menu.

TODO: test if first entry (ID=0) really can't be a submenu.

func (menu *Menu) Clear()

Clear resets the menu items list.

func (menu *Menu) Launch(id int32)

Launch calls the action referenced by its id.

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

MenuData stores the menu data to send, and callbacks to launch on return.

type SubIcon Uses

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

SubIcon defines a connection to the subdock icon.

func (*SubIcon) Animate Uses

func (cdi *SubIcon) Animate(animation string, rounds int) error

Animate animates the subicon, with a given animation and for a given number of rounds. See Icon.

func (*SubIcon) SetEmblem Uses

func (cdi *SubIcon) SetEmblem(icon string, position cdtype.EmblemPosition) error

SetEmblem set an emblem image on the subicon. See Icon.

func (*SubIcon) SetIcon Uses

func (cdi *SubIcon) SetIcon(icon string) error

SetIcon set the image of the subicon, overwriting the previous one. See Icon.

func (*SubIcon) SetLabel Uses

func (cdi *SubIcon) SetLabel(label string) error

SetLabel change the text label next to the subicon.

func (*SubIcon) SetQuickInfo Uses

func (cdi *SubIcon) SetQuickInfo(info string) error

SetQuickInfo change the quickinfo text displayed on the subicon.

func (*SubIcon) ShowDialog Uses

func (cdi *SubIcon) ShowDialog(message string, duration int) error

ShowDialog pops up a simple dialog bubble on the subicon. See Icon.

Package appdbus imports 11 packages (graph) and is imported by 13 packages. Updated 2017-09-27. Refresh now. Tools for package owners.