godock: github.com/sqp/godock/libs/srvdbus/dockbus Index | Files

package dockbus

import "github.com/sqp/godock/libs/srvdbus/dockbus"

Package dockbus provides a Dbus client for the main dock Dbus service.

Use with caution when gldi is enabled as the client and server should be on the same thread.

Most functions in this package are unused, and some of them were made to support widget/confbuilder/datadbus, the GUI data source from Dbus, which is unused and unpublished (may be around 50% features, with missing API evolutions).

So if you need to use this package, which isn't grouped in the applet API due to lack of use, and ideas to provide a common set for Dbus+Gldi, let us know your needs, and if current methods are fine for you.

Index

Package Files

dockbus.go

Constants

const (
    IconTypeApplet    = "Applet"
    IconTypeLauncher  = "Launcher"
    IconTypeSeparator = "Separator"
    IconTypeSubDock   = "Stack-icon"
    IconTypeTaskbar   = "Taskbar"
)

Dock icon types.

func Action Uses

func Action(action func(*Client) error) error

Action sends an action to the dock server.

func AppletAdd Uses

func AppletAdd(name string) error

AppletAdd adds an applet instance referenced by its name.

func AppletInstances Uses

func AppletInstances(name string) ([]string, error)

AppletInstances asks the dock the list of active instances for an applet. Instances references are full paths to their config files.

func AppletRemove Uses

func AppletRemove(configFile string) error

AppletRemove removes an applet instance referenced by its config file.

func DeskletShow Uses

func DeskletShow(mode int) error

DeskletShow sets the desklet visibility: 0 = hide, 1 = show, 2 = toggle.

func DockAdd Uses

func DockAdd(args map[string]interface{}) error

DockAdd adds an item to the Dock.

Launcher from desktop file:      "type":"Launcher", "config-file":"application://vlc.desktop"
Launcher custom:                 "type":"Launcher", "name":"Top 10", "command":"xterm -e top", "icon":"go-home.png"
Stack icon (SubDock container)   "type":"Stack-Icon", "name":"my sub-dock", "icon":"folder.png"
Separator                        "type":"Separator"
Module                           "type":"Module", "module":"clock"
MainDock                         "type":"Dock"

Optional arguments:

Icon relative position                   "order":5
Icon location (main or subdock name)     "container":"_MainDock_"
Launcher application class               "class":"gjiten"

func DockProperties Uses

func DockProperties(arg string) ([]map[string]interface{}, error)

DockProperties gets properties of different parts of the dock. API may change for this function. Need to figure out the best way to return the data.

"type=Launcher & class=firefox"
"type=Module"
"type=Module & name=clock"
"type=Desklet"

var name, icon string
for _, t := range vars {
	for k, v := range t {
		if k == "icon" {
			log.Info(mod, v)
		}
	}
}

func DockQuit Uses

func DockQuit() error

DockQuit sends the Quit action to the dock dbus.

func DockReboot Uses

func DockReboot() error

DockReboot reload the current theme of the Dock, as if you had quit and restarted the dock.

func DockRemove Uses

func DockRemove(arg string) error

DockRemove removes an item from the Dock.

Launcher                                  "type=Launcher & class=vlc"
Second main dock (and all its content)    "type=Dock & name=_MainDock_-2"
Module                                    "type=Module & name=clock"
Instance of a module                      "type=Module-Instance & config-file=clock.conf"

func DockShow Uses

func DockShow(mode int) error

DockShow sets the dock visibility: 0 = hide, 1 = show, 2 = toggle. If you have several docks, it will show/hide all of them.

func IconReload Uses

func IconReload(arg string) error

IconReload reloads an icon settings from disk.

"type=Module & name=weather"
"config-file=full_path_to_config_or_desktop_file"

func InfoApplet Uses

func InfoApplet(log cdtype.Logger, name string) *packages.AppletPackage

InfoApplet asks the dock all informations about an applet.

func ListIcons Uses

func ListIcons(log cdtype.Logger) (list []*CDIcon)

ListIcons asks the dock the list of active icons.

TODO: add argument for advanced queries. would be cool to have argument list.

func ListIconsOrdered Uses

func ListIconsOrdered(log cdtype.Logger) map[string]IconsByOrder

ListIconsOrdered builds the list of dock icons sorted by container and order.

func ListKnownApplets Uses

func ListKnownApplets(log cdtype.Logger) (map[string]*packages.AppletPackage, error)

ListKnownApplets asks the dock informations about all known applets.

type CDIcon Uses

type CDIcon struct {
    Name     string
    Xid      uint32
    Position int
    Type     string // Applet, Launcher, Stack-icon, Separator
    // TODO compare
    // Type          PackageType // type of package : installed, user, distant...
    QuickInfo  string
    Container  string
    Command    string
    Order      float64
    ConfigFile string
    Icon       string
    Class      string
    Module     string
    // contains filtered or unexported fields
}

CDIcon defines a dock icon properties.

func (*CDIcon) DefaultNameIcon Uses

func (icon *CDIcon) DefaultNameIcon(applets map[string]*packages.AppletPackage) (name, img string)

DefaultNameIcon returns improved name and image for the icon if possible. (can fix those for applets using the given list)

func (*CDIcon) FormatName Uses

func (icon *CDIcon) FormatName() (name string)

FormatName return the user readable name for the icon.

func (*CDIcon) IsTaskbar Uses

func (icon *CDIcon) IsTaskbar() bool

IsTaskbar returns whether the icon belongs to the taskbar or not.

type Client Uses

type Client struct {
    *dbuscommon.Client
}

Client defines a Dbus client connected to the dock server.

func NewClient Uses

func NewClient() (*Client, error)

NewClient creates a Client connected to the dock server.

func (*Client) DockProperties Uses

func (cl *Client) DockProperties(arg string) ([]map[string]interface{}, error)

DockProperties gets properties of different parts of the dock. see dockbus.DockProperties

func (*Client) Quit Uses

func (cl *Client) Quit() error

Quit sends the Quit action to the dock dbus.

func (*Client) Reboot Uses

func (cl *Client) Reboot() error

Reboot reload the current theme of the Dock, as if you had quit and restarted the dock.

type IconsByOrder Uses

type IconsByOrder []*CDIcon

IconsByOrder defines a list of icons that can be sorted on the order field.

func (IconsByOrder) Len Uses

func (a IconsByOrder) Len() int

Len returns the size of the list.

func (IconsByOrder) Less Uses

func (a IconsByOrder) Less(i, j int) bool

Less compares the order of two icons.

func (IconsByOrder) Swap Uses

func (a IconsByOrder) Swap(i, j int)

Swap swaps the position of two icons.

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