Exemplo n.º 1
0
// 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:"
}
Exemplo n.º 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")
}
Exemplo n.º 3
0
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
}