import "github.com/burntsushi/xgb" conn, err := xgb.NewConn() if err != nil { // handle error } defer conn.Close()
import "github.com/burntsushi/xgb/xproto" screen := xproto.Setup(conn).DefaultScreen(conn) root := screen.Root sizeCookie := xproto.GetGeometry(conn, root) reply, err := sizeCookie.Reply() if err != nil { // handle error } width := int(reply.Width) height := int(reply.Height)This example uses the xproto package, which provides a high-level API for working with X protocol requests and replies. The `GetGeometry` function sends a request to the server to retrieve information about the specified drawable (in this case, the root window). The returned cookie can be used to retrieve the reply, which includes the width and height of the drawable.