Debian Codegraph @

nix_dbus_available.go

raw
1 //go:build !s390x && !ppc64le && !darwin && !windows && (linux || openbsd || netbsd)
2
3 package screenshot
4
5 import (
6 "image"
7 "os"
8 )
9
10 // Capture returns screen capture of specified desktop region.
11 // x and y represent distance from the upper-left corner of primary display.
12 // Y-axis is downward direction. This means coordinates system is similar to Windows OS.
13 func Capture(x, y, width, height int) (img *image.RGBA, e error) {
14 sessionType := os.Getenv("XDG_SESSION_TYPE")
15 if sessionType == "wayland" {
16 return captureDbus(x, y, width, height)
17 } else {
18 return captureXinerama(x, y, width, height)
19 }
20 }