What problem does it solve?
Patterns, gotchas, and best practices for cross-platform desktop automation with robotgo in Go. Covers display requirements, mouse/keyboard APIs, screenshot handling, window management, multi-monitor support, CGO, X11 specifics, and testing headless environments. Use when implementing or debugging robotgo-based tools, handling display errors, working with screen coordinates, or setting up headless CI testing.
Core Features & Use Cases
- Display requirements: ensure a valid X11 display is set for Linux, and provide guidance for headless CI with Xvfb.
- Mouse API: full examples of moving, clicking, dragging, and scrolling across monitors.
- Keyboard API: key taps, modifiers, and text input across OSes.
- Screen / Screenshot API: capturing regions or full screens, encoding to PNG, and returning base64 payloads for transport.
- Window Management API: focusing, moving, resizing, and toggling window states across platforms.
- Multi-Monitor Support: coordinate across displays and determine display counts.
- OCR (via gosseract): text extraction from screenshots using Tesseract.
- Testing headless environments: CI-friendly patterns and Xvfb usage.
- Gotchas & troubleshooting: common pitfalls and safe usage notes.
Quick Start
Install Go, configure a project that uses the robotgo patterns, and begin implementing your desktop automation tasks.