コード例 #1
0
ファイル: misc.go プロジェクト: cshapeshifter/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:"
}
コード例 #2
0
ファイル: toggles.go プロジェクト: cshapeshifter/wingo
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")
}
コード例 #3
0
ファイル: get.go プロジェクト: cshapeshifter/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
}