appdbus

package
v0.0.0-...-0caaa62 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func StandAlone

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.

Types

type CDDbus

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

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

func New

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 (*CDDbus) AddMenuItems

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

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

func (*CDDbus) AddSubIcon

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

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

func (*CDDbus) Animate

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

Animate animates the icon for a given number of rounds.

func (*CDDbus) BindShortkey

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

BindShortkey binds one or more keyboard shortcuts to your applet.

func (*CDDbus) ConnectEvents

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

ConnectEvents registers to receive Dbus applet events.

func (*CDDbus) ConnectToBus

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

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

func (*CDDbus) DataRenderer

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

DataRenderer manages the graphic data renderer of the icon.

func (*CDDbus) DemandsAttention

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

DemandsAttention is an endless Animate method.

func (*CDDbus) IconProperties

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

IconProperties returns all applet icon properties at once.

func (*CDDbus) IconProperty

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

IconProperty returns applet icon properties one by one.

func (*CDDbus) OnSignal

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

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

PopupDialog open a dialog box . See cdtype.AppIcon.

func (*CDDbus) RemoveSubIcon

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

RemoveSubIcon only need the ID to remove the SubIcon.

func (*CDDbus) RemoveSubIcons

func (cda *CDDbus) RemoveSubIcons() error

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

func (*CDDbus) SetEmblem

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

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

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

func (*CDDbus) SetLabel

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

SetLabel change the text label next to the icon.

func (*CDDbus) SetOnEvent

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

SetOnEvent sets the OnEvent callback to forwards events.

func (*CDDbus) SetQuickInfo

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

SetQuickInfo change the quickinfo text displayed on the icon.

func (*CDDbus) ShowDialog

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

ShowDialog pops up a simple dialog bubble on the icon.

func (*CDDbus) SubIcon

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

SubIcon returns the subicon object matching the given key.

func (*CDDbus) Window

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

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

SubIcon defines a connection to the subdock icon.

func (*SubIcon) Animate

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

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

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

func (*SubIcon) SetIcon

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

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

func (*SubIcon) SetLabel

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

SetLabel change the text label next to the subicon.

func (*SubIcon) SetQuickInfo

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

SetQuickInfo change the quickinfo text displayed on the subicon.

func (*SubIcon) ShowDialog

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

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

Jump to

Keyboard shortcuts

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