Example #1
0
// WM_CLASS set
func WmClassSet(xu *xgbutil.XUtil, win xproto.Window, class *WmClass) error {
	raw := make([]byte, len(class.Instance)+len(class.Class)+2)
	copy(raw, class.Instance)
	copy(raw[(len(class.Instance)+1):], class.Class)

	return xprop.ChangeProp(xu, win, 8, "WM_CLASS", "STRING", raw)
}
Example #2
0
// _NET_DESKTOP_NAMES set
func DesktopNamesSet(xu *xgbutil.XUtil, names []string) error {
	nullterm := make([]byte, 0)
	for _, name := range names {
		nullterm = append(nullterm, name...)
		nullterm = append(nullterm, 0)
	}
	return xprop.ChangeProp(xu, xu.RootWin(), 8, "_NET_DESKTOP_NAMES",
		"UTF8_STRING", nullterm)
}
Example #3
0
func StatusSet(X *xgbutil.XUtil, status bool) {
	var statusStr string
	if status {
		statusStr = "Success"
	} else {
		statusStr = "Error"
	}

	// throw away the error
	xprop.ChangeProp(X, X.RootWin(), 8, "_WINGO_CMD_STATUS", "UTF8_STRING",
		[]byte(statusStr))
}
Example #4
0
func (cmd TagSet) Run() gribble.Value {
	if !validTagName.MatchString(cmd.Name) {
		return cmdError("Tag names must match %s.", validTagName.String())
	}

	var err error
	withClient(cmd.Client, func(c *xclient.Client) {
		tagName := fmt.Sprintf("_WINGO_TAG_%s", cmd.Name)
		err = xprop.ChangeProp(wm.X, c.Id(), 8, tagName, "UTF8_STRING",
			[]byte(cmd.Value))
	})
	if err != nil {
		return cmdError(err.Error())
	}
	return ""
}
Example #5
0
func (cmd TagSet) Run() gribble.Value {
	if !validTagName.MatchString(cmd.Name) {
		return cmdError("Tag names must match %s.", validTagName.String())
	}

	var cid xproto.Window
	tagName := fmt.Sprintf("_WINGO_TAG_%s", cmd.Name)
	if n, ok := cmd.Client.(int); ok && n == 0 {
		cid = wm.Root.Id
	} else {
		withClient(cmd.Client, func(c *xclient.Client) {
			cid = c.Id()
		})
	}
	err := xprop.ChangeProp(wm.X, cid, 8, tagName, "UTF8_STRING",
		[]byte(cmd.Value))
	if err != nil {
		return cmdError(err.Error())
	}
	return ""
}
Example #6
0
// _NET_WM_NAME set
func WmNameSet(xu *xgbutil.XUtil, win xproto.Window, name string) error {
	return xprop.ChangeProp(xu, win, 8, "_NET_WM_NAME", "UTF8_STRING",
		[]byte(name))
}
Example #7
0
// WM_ICON_NAME set
func WmIconNameSet(xu *xgbutil.XUtil, win xproto.Window, name string) error {
	return xprop.ChangeProp(xu, win, 8, "WM_ICON_NAME", "STRING",
		([]byte)(name))
}
Example #8
0
// WM_CLIENT_MACHINE set
func WmClientMachineSet(xu *xgbutil.XUtil, win xproto.Window,
	client string) error {

	return xprop.ChangeProp(xu, win, 8, "WM_CLIENT_MACHINE", "STRING",
		([]byte)(client))
}
Example #9
0
func CmdSet(X *xgbutil.XUtil, cmd string) error {
	return xprop.ChangeProp(X, X.RootWin(), 8,
		"_WINGO_CMD", "UTF8_STRING", []byte(cmd))
}