Example #1
0
File: misc.go Project: mkrull/wingo
// Shortcut for executing Client interface functions that have no parameters
// and no return values on the currently focused window.
func withFocused(f func(c *xclient.Client)) gribble.Any {
	if focused := wm.LastFocused(); focused != nil {
		client := focused.(*xclient.Client)
		f(client)
		return int(client.Id())
	}
	return ":void:"
}
Example #2
0
func (c *Client) attnStop() {
	if !c.demanding {
		return
	}

	c.attnQuit <- struct{}{}
	c.demanding = false

	// If this client is the last focused client, then make it active.
	if wm.LastFocused().Id() == c.Id() {
		c.frame.Active()
	} else {
		c.frame.Inactive()
	}

	c.removeState("_NET_WM_STATE_DEMANDS_ATTENTION")
}
Example #3
0
File: get.go Project: mkrull/wingo
func (cmd GetActive) Run() gribble.Value {
	reply, err := xproto.GetInputFocus(wm.X.Conn()).Reply()
	if err != nil {
		logger.Warning.Printf("Could not get input focus: %s", err)
		return 0
	}

	// If our dummy window has focus, then it's equivalent to having root
	// window focus.
	// XXX: This may not be right if we're in a DE with desktop windows...
	if reply.Focus == wm.X.Dummy() {
		return 0
	}
	if focused := wm.LastFocused(); focused != nil {
		client := focused.(*xclient.Client)
		return int(client.Id())
	}
	return 0
}