cdapplet

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 cdapplet is the Cairo-Dock applet base object, using DBus or Gldi backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

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

Start starts an instance of the given applet name.

Types

type CDApplet

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

func New() *CDApplet

New creates a new applet manager.

func (*CDApplet) Action

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

Action returns a manager of launchable actions for applets

func (*CDApplet) Command

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

Command returns a manager of launchable commands for applets

func (*CDApplet) FileDataDir

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

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

func (*CDApplet) FileLocation

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

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

func (*CDApplet) LoadConfig

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

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

Log gives access to the applet logger.

func (*CDApplet) Name

func (cda *CDApplet) Name() string

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

func (*CDApplet) OnEvent

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

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

Poller return the applet poller if any.

func (*CDApplet) SetBackend

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

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

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

func (*CDApplet) SetConfig

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

SetConfig sets the applet config pointer and can add actions.

func (*CDApplet) SetDefaults

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

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

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

Translate translates a string in the applet domain.

func (*CDApplet) UpdateConfig

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

Path Synopsis
Package action provides actions management for applets.
Package action provides actions management for applets.

Jump to

Keyboard shortcuts

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