aboutsummaryrefslogtreecommitdiff
path: root/nexgb/examples/xinerama.go
blob: 7fe998438f35ea5b023460d89b46c9b8ba59c7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

import (
	"fmt"
	"log"

	"github.com/BurntSushi/xgb"
)

func main() {
	X, _ := xgb.NewConn()

	err := X.RegisterExtension("xinerama")
	if err != nil {
		log.Fatal(err)
	}

	reply, err := X.XineramaQueryScreens().Reply()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Xinerama number: %d\n", reply.Number)
	for i, screen := range reply.ScreenInfo {
		fmt.Printf("%d :: X: %d, Y: %d, Width: %d, Height: %d\n",
			i, screen.XOrg, screen.YOrg, screen.Width, screen.Height)
	}
}