Пример #1
0
func (cmd Focus) Run() gribble.Value {
	return syncRun(func() gribble.Value {
		return withClient(cmd.Client, func(c *xclient.Client) {
			if c == nil {
				focus.Root()

				// Use the mouse coordinates to find which workspace it was
				// clicked in. If a workspace can be found (i.e., no clicks in
				// dead areas), then activate it.
				xc, rw := wm.X.Conn(), wm.X.RootWin()
				qp, err := xproto.QueryPointer(xc, rw).Reply()
				if err != nil {
					logger.Warning.Printf("Could not query pointer: %s", err)
					return
				}

				geom := xrect.New(int(qp.RootX), int(qp.RootY), 1, 1)
				if wrk := wm.Heads.FindMostOverlap(geom); wrk != nil {
					wm.SetWorkspace(wrk, false)
				}
			} else {
				c.Focus()
				xevent.ReplayPointer(wm.X)
			}
		})
	})
}
Пример #2
0
func getRootMouseCommand(cmd string) func() {
	switch cmd {
	case "Focus":
		return func() {
			focus.Root()
		}
	}

	return nil
}
Пример #3
0
func (wingo *wingoState) focusFallback() {
	wrk := wingo.workspace()
	for i := len(focus.Clients) - 1; i >= 0; i-- {
		switch client := focus.Clients[i].(type) {
		case *client:
			if client.frame.IsMapped() && client.workspace == wrk {
				focus.Focus(client)
				return
			}
		default:
			fmt.Printf("Unsupported client type: %T", client)
			panic("Not implemented.")
		}
	}
	focus.Root()
}