2026-04-03 13:24:49 -05:00
|
|
|
//go:build linux
|
|
|
|
|
|
|
|
|
|
package capture
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"image"
|
|
|
|
|
|
|
|
|
|
"github.com/kbinani/screenshot"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func displayBounds(idx int) image.Rectangle {
|
2026-04-03 19:43:41 -05:00
|
|
|
if !isWaylandSession && !x11Disabled.Load() {
|
|
|
|
|
if b := x11DisplayBounds(idx); b.Dx() > 0 && b.Dy() > 0 {
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
n := screenshot.NumActiveDisplays()
|
|
|
|
|
if idx < 0 || idx >= n {
|
|
|
|
|
return image.Rectangle{}
|
|
|
|
|
}
|
2026-04-03 13:24:49 -05:00
|
|
|
return screenshot.GetDisplayBounds(idx)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func displayScale(idx int) float64 {
|
|
|
|
|
return 1.0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func MonitorInfos() []MonitorInfo {
|
2026-04-03 19:43:41 -05:00
|
|
|
n := displayCount()
|
2026-04-03 13:24:49 -05:00
|
|
|
infos := make([]MonitorInfo, 0, n)
|
|
|
|
|
for i := 0; i < n; i++ {
|
2026-04-03 19:43:41 -05:00
|
|
|
b := displayBounds(i)
|
2026-04-03 13:24:49 -05:00
|
|
|
infos = append(infos, MonitorInfo{
|
|
|
|
|
Width: b.Dx(),
|
|
|
|
|
Height: b.Dy(),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return infos
|
|
|
|
|
}
|