Example #1
0
// IconProperties returns all applet icon properties at once.
//
func (cda *CDDbus) IconProperties() (cdtype.IconProperties, error) {
	var list map[string]interface{}
	e := cda.dbusIcon.Get("GetAll", []interface{}{&list})
	if e != nil {
		return nil, e
	}

	props := &iconProps{}
	for k, v := range list {
		switch k {
		case "Xid":
			props.xid = v.(uint64)
		case "x":
			props.x = int(v.(int32))
		case "y":
			props.y = int(v.(int32))
		case "orientation":
			props.containerPosition = cdtype.ContainerPosition(v.(uint32))
		case "container":
			props.containerType = cdtype.ContainerType(v.(uint32) + 1) // +1 as we have an unknown as 0 in this version.
		case "width":
			props.width = int(v.(int32))
		case "height":
			props.height = int(v.(int32))
		case "has_focus":
			props.hasFocus = v.(bool)
		}
	}
	return props, nil
}
Example #2
0
func (o *iconProp) ContainerType() (cdtype.ContainerType, error) {
	var val uint32
	e := o.dbusIcon.Get("Get", []interface{}{&val}, "container")
	if e != nil {
		return cdtype.ContainerUnknown, e
	}
	return cdtype.ContainerType(val + 1), e // +1 as we have an unknown as 0 in this version.
}