Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearProviders ¶
func ClearProviders()
ClearProviders removes all registered providers (primarily for testing)
Types ¶
type DisplayController ¶
type DisplayController interface {
// Screen operations
CaptureScreenBytes(ctx context.Context, region *Region) ([]byte, error)
CaptureScreen(ctx context.Context, region *Region) (image.Image, error)
GetScreenDimensions(ctx context.Context) (width, height int, err error)
// Mouse operations
GetCursorPosition(ctx context.Context) (x, y int, err error)
MoveMouse(ctx context.Context, x, y int) error
ClickMouse(ctx context.Context, button MouseButton, clicks int) error
ScrollMouse(ctx context.Context, clicks int, direction string) error
// Keyboard operations
TypeText(ctx context.Context, text string, delayMs int) error
SendKeyCombo(ctx context.Context, combo string) error
// Lifecycle
Close() error
}
DisplayController abstracts display server-specific operations (X11, Wayland, macOS Quartz)
type DisplayInfo ¶
type DisplayInfo struct {
Name string // "x11", "wayland", "macos"
SupportsRegions bool
SupportsMouse bool
SupportsKeyboard bool
MaxTextLength int
RequiresElevation bool
}
DisplayInfo contains metadata about a display server or protocol
type FocusManager ¶
type FocusManager interface {
// GetFrontmostApp returns the identifier of the currently focused application
GetFrontmostApp(ctx context.Context) (string, error)
// ActivateApp brings an application to the foreground
ActivateApp(ctx context.Context, appIdentifier string) error
// GetTerminalApp returns the identifier of the terminal application
GetTerminalApp(ctx context.Context) (string, error)
// SwitchToTerminal switches focus to the terminal application
SwitchToTerminal(ctx context.Context) error
}
FocusManager is an optional interface for window focus management Only implemented by platforms that support it (e.g., macOS)
type MouseButton ¶
type MouseButton int
MouseButton represents a mouse button
const ( MouseButtonLeft MouseButton = iota MouseButtonMiddle MouseButtonRight )
func ParseMouseButton ¶
func ParseMouseButton(s string) MouseButton
ParseMouseButton parses a string into a MouseButton
func (MouseButton) String ¶
func (b MouseButton) String() string
String returns the string representation of a mouse button
type Provider ¶
type Provider interface {
// GetController creates a new DisplayController (display is auto-detected from environment)
GetController() (DisplayController, error)
// GetDisplayInfo returns information about the display server/protocol
GetDisplayInfo() DisplayInfo
// IsAvailable returns true if this display server is available on the current system
IsAvailable() bool
}
Provider creates DisplayController instances for a specific display server/protocol
func DetectDisplay ¶
DetectDisplay returns the first available display server provider Priority is determined by registration order (first registered has highest priority)
func GetAllProviders ¶
func GetAllProviders() []Provider
GetAllProviders returns all registered providers
func GetProvider ¶
GetProvider returns a specific provider by display server name, or nil if not found