dockbus

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: 8 Imported by: 0

Documentation

Overview

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

Constants

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

Dock icon types.

Variables

This section is empty.

Functions

func Action

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

Action sends an action to the dock server.

func AppletAdd

func AppletAdd(name string) error

AppletAdd adds an applet instance referenced by its name.

func AppletInstances

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

func AppletRemove(configFile string) error

AppletRemove removes an applet instance referenced by its config file.

func DeskletShow

func DeskletShow(mode int) error

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

func DockAdd

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

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

func DockQuit() error

DockQuit sends the Quit action to the dock dbus.

func DockReboot

func DockReboot() error

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

func DockRemove

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

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

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

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

InfoApplet asks the dock all informations about an applet.

func ListIconsOrdered

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

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

func ListKnownApplets

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

ListKnownApplets asks the dock informations about all known applets.

Types

type CDIcon

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 ListIcons

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 (*CDIcon) DefaultNameIcon

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

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

FormatName return the user readable name for the icon.

func (*CDIcon) IsTaskbar

func (icon *CDIcon) IsTaskbar() bool

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

type Client

type Client struct {
	*dbuscommon.Client
}

Client defines a Dbus client connected to the dock server.

func NewClient

func NewClient() (*Client, error)

NewClient creates a Client connected to the dock server.

func (*Client) DockProperties

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

func (cl *Client) Quit() error

Quit sends the Quit action to the dock dbus.

func (*Client) Reboot

func (cl *Client) Reboot() error

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

type IconsByOrder

type IconsByOrder []*CDIcon

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

func (IconsByOrder) Len

func (a IconsByOrder) Len() int

Len returns the size of the list.

func (IconsByOrder) Less

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

Less compares the order of two icons.

func (IconsByOrder) Swap

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

Swap swaps the position of two icons.

Jump to

Keyboard shortcuts

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