Go Display Index

A cross-platform Go package to detect which display contains the cursor.
Features
- Supports Windows, macOS, and Linux
- Simple API
Installation
go get github.com/jasonlovesdoggo/displayindex
Usage
package main
import (
"fmt"
"github.com/jasonlovesdoggo/displayindex"
"github.com/kbinani/screenshot"
)
func main() {
index, err := displayindex.CurrentDisplayIndex()
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Printf("Cursor is on display %d\n", index)
img, err := screenshot.CaptureDisplay(index) /* Example how you can use the index*/
if err != nil {
fmt.Println("Error:", err)
return
}
// Do something with the image
}
Requirements