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
- func Action(action func(*Client) error) error
- func AppletAdd(name string) error
- func AppletInstances(name string) ([]string, error)
- func AppletRemove(configFile string) error
- func DeskletShow(mode int) error
- func DockAdd(args map[string]interface{}) error
- func DockProperties(arg string) ([]map[string]interface{}, error)
- func DockQuit() error
- func DockReboot() error
- func DockRemove(arg string) error
- func DockShow(mode int) error
- func IconReload(arg string) error
- func InfoApplet(log cdtype.Logger, name string) *packages.AppletPackage
- func ListIconsOrdered(log cdtype.Logger) map[string]IconsByOrder
- func ListKnownApplets(log cdtype.Logger) (map[string]*packages.AppletPackage, error)
- type CDIcon
- type Client
- type IconsByOrder
Constants ¶
const ( IconTypeApplet = "Applet" IconTypeLauncher = "Launcher" IconTypeSeparator = "Separator" IconTypeSubDock = "Stack-icon" IconTypeTaskbar = "Taskbar" )
Dock icon types.
Variables ¶
This section is empty.
Functions ¶
func AppletInstances ¶
AppletInstances asks the dock the list of active instances for an applet. Instances references are full paths to their config files.
func AppletRemove ¶
AppletRemove removes an applet instance referenced by its config file.
func DeskletShow ¶
DeskletShow sets the desklet visibility: 0 = hide, 1 = show, 2 = toggle.
func DockAdd ¶
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 ¶
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 DockReboot ¶
func DockReboot() error
DockReboot reload the current theme of the Dock, as if you had quit and restarted the dock.
func DockRemove ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
FormatName return the user readable name for the icon.
type Client ¶
type Client struct {
*dbuscommon.Client
}
Client defines a Dbus client connected to the dock server.
func (*Client) DockProperties ¶
DockProperties gets properties of different parts of the dock. see dockbus.DockProperties
type IconsByOrder ¶
type IconsByOrder []*CDIcon
IconsByOrder defines a list of icons that can be sorted on the order field.
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.