godock: github.com/sqp/godock/libs/cdapplet Index | Files | Directories

package cdapplet

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

Package cdapplet is the Cairo-Dock applet base object, using DBus or Gldi backend.

Index

Package Files

cdapplet.go events.go

func Start Uses

func Start(callnew cdtype.NewAppletFunc, base *CDApplet) cdtype.AppInstance

Start starts an instance of the given applet name.

type CDApplet Uses

type CDApplet struct {
    cdtype.AppIcon // Dock applet connection, Can be Gldi or Dbus (will be Gldi with build tag dock).
    // contains filtered or unexported fields
}

CDApplet is the base Cairo-Dock applet manager that will handle all your communications with the dock and provide some methods commonly needed by applets.

func New Uses

func New() *CDApplet

New creates a new applet manager.

func (*CDApplet) Action Uses

func (cda *CDApplet) Action() cdtype.AppAction

Action returns a manager of launchable actions for applets

func (*CDApplet) Command Uses

func (cda *CDApplet) Command() cdtype.AppCommand

Command returns a manager of launchable commands for applets

func (*CDApplet) FileDataDir Uses

func (cda *CDApplet) FileDataDir(filename ...string) string

FileDataDir returns the path to the config root dir (~/.config/cairo-dock).

func (*CDApplet) FileLocation Uses

func (cda *CDApplet) FileLocation(filename ...string) string

FileLocation return the full path to a file in the applet data dir.

func (*CDApplet) LoadConfig Uses

func (cda *CDApplet) LoadConfig(loadConf bool) (cdtype.Defaults, error)

LoadConfig will try to create and fill the given config struct with data from the configuration file. Log error and crash if something went wrong. Won't do anything if loadConf is false.

func (*CDApplet) Log Uses

func (cda *CDApplet) Log() cdtype.Logger

Log gives access to the applet logger.

func (*CDApplet) Name Uses

func (cda *CDApplet) Name() string

Name returns the applet name as known by the dock. As an external app = dir name.

func (*CDApplet) OnEvent Uses

func (cda *CDApplet) OnEvent(event string, data ...interface{}) (exit bool)

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

func (*CDApplet) Poller Uses

func (cda *CDApplet) Poller() cdtype.AppPoller

Poller return the applet poller if any.

func (*CDApplet) SetBackend Uses

func (cda *CDApplet) SetBackend(base cdtype.AppBackend)

SetBackend sets the applet backend and connects its OnEvent callback to the OnEvent method provided here.

 Before           After
-------------    -------------
|           |    |           |<==\
|    -------|    |    -------|   |
|    |      |    |    | back |   | OnEvent
|    |      |    |    | end  |===/
-------------    -------------

func (*CDApplet) SetBase Uses

func (cda *CDApplet) SetBase(name, conf, rootdir, sharedir string)

SetBase sets the name, conf and dirs for the applet.

func (*CDApplet) SetConfig Uses

func (cda *CDApplet) SetConfig(confPtr interface{}, actions ...*cdtype.Action)

SetConfig sets the applet config pointer and can add actions.

func (*CDApplet) SetDefaults Uses

func (cda *CDApplet) SetDefaults(def cdtype.Defaults)

SetDefaults set basic defaults icon settings in one call. Empty fields will be reset, so this is better used in the Init() call.

func (*CDApplet) SetEvents Uses

func (cda *CDApplet) SetEvents(app cdtype.AppInstance) func() error

SetEvents connects events defined by the applet to the dock.

Returns the first init call func.

func (*CDApplet) Translate Uses

func (cda *CDApplet) Translate(str string) string

Translate translates a string in the applet domain.

func (*CDApplet) UpdateConfig Uses

func (cda *CDApplet) UpdateConfig() (cdtype.ConfUpdater, error)

UpdateConfig opens the applet config file for edition.

You must ensure that Save or Cancel is called, and fast to prevent memory leaks and deadlocks.

Directories

PathSynopsis
actionPackage action provides actions management for applets.

Package cdapplet imports 11 packages (graph) and is imported by 2 packages. Updated 2017-10-03. Refresh now. Tools for package owners.