display

package
v0.99.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 4 Imported by: 0

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)

func Register

func Register(provider Provider)

Register adds a display server provider to the global registry This is typically called from init() functions in display-specific packages

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

func DetectDisplay() (Provider, error)

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

func GetProvider(displayName string) Provider

GetProvider returns a specific provider by display server name, or nil if not found

type Region

type Region struct {
	X      int
	Y      int
	Width  int
	Height int
}

Region represents a rectangular area on the screen

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages display server providers and handles display detection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL