Пример #1
0
func (d *Desktop) Tile(conn *xgb.Conn) {
	if d.Head == 0 {
		if d.Clients == nil {
			return
		}

		d.Head = d.Clients[0]
		d.Clients = d.Clients[1:]

	}

	wsplit := uint32(.8 * float64(d.W))

	// The second argument to ConfigureWindow is the valuemask
	// where we decide which values to change
	// 1|2|3|4 says that we want to change the window's X, Y, W and H

	conn.ConfigureWindow(d.Head, 1|2|3|4, []uint32{0, 0, wsplit, uint32(d.H)})

	if d.Clients != nil {
		n := 1
		for y := 0; y <= d.H; y += int(float64(d.H) / float64(len(d.Clients))) {
			conn.ConfigureWindow(d.Clients[n-1], 1|2|3|4, []uint32{wsplit, uint32(y), uint32(d.W) - wsplit, uint32(float64(d.H) / float64(len(d.Clients)))})
			n += 1
			if n > len(d.Clients) {
				return
			}
		}
	}
}