x11

package
v0.167.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller wraps the existing X11Client to implement the display.DisplayController interface

func (*Controller) CaptureScreen

func (c *Controller) CaptureScreen(ctx context.Context, region *display.Region) (image.Image, error)

CaptureScreen captures a screenshot and returns an image.Image

func (*Controller) CaptureScreenBytes

func (c *Controller) CaptureScreenBytes(ctx context.Context, region *display.Region) ([]byte, error)

CaptureScreenBytes captures a screenshot and returns PNG bytes

func (*Controller) ClickMouse

func (c *Controller) ClickMouse(ctx context.Context, button display.MouseButton, clicks int) error

ClickMouse clicks the specified mouse button

func (*Controller) Close

func (c *Controller) Close() error

Close closes the X11 connection

func (*Controller) GetCursorPosition

func (c *Controller) GetCursorPosition(ctx context.Context) (x, y int, err error)

GetCursorPosition returns the current cursor position

func (*Controller) GetScreenDimensions

func (c *Controller) GetScreenDimensions(ctx context.Context) (width, height int, err error)

GetScreenDimensions returns the screen width and height

func (*Controller) MoveMouse

func (c *Controller) MoveMouse(ctx context.Context, x, y int) error

MoveMouse moves the cursor to the specified coordinates

func (*Controller) ScrollMouse

func (c *Controller) ScrollMouse(ctx context.Context, clicks int, direction string) error

ScrollMouse scrolls the mouse wheel

func (*Controller) SendKeyCombo

func (c *Controller) SendKeyCombo(ctx context.Context, combo string) error

SendKeyCombo sends a key combination (e.g., "ctrl+c", "super+l")

func (*Controller) TypeText

func (c *Controller) TypeText(ctx context.Context, text string, delayMs int) error

TypeText types the given text with the specified delay between keystrokes

type Provider

type Provider struct{}

Provider implements the display.Provider interface for X11

func NewProvider

func NewProvider() *Provider

NewProvider creates a new X11 provider

func (*Provider) GetController

func (p *Provider) GetController() (display.DisplayController, error)

GetController creates a new DisplayController (auto-detects display from $DISPLAY env var)

func (*Provider) GetDisplayInfo

func (p *Provider) GetDisplayInfo() display.DisplayInfo

GetDisplayInfo returns information about the X11 platform

func (*Provider) IsAvailable

func (p *Provider) IsAvailable() bool

IsAvailable returns true if X11 is available on the current system

type X11Client

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

X11Client wraps X11 connection and provides screen control operations

func NewX11Client

func NewX11Client(display string) (*X11Client, error)

NewX11Client creates a new X11 client connection

func (*X11Client) CaptureScreen

func (c *X11Client) CaptureScreen(x, y, width, height int) (image.Image, error)

CaptureScreen captures a screenshot of the entire screen or a region

func (*X11Client) CaptureScreenBytes

func (c *X11Client) CaptureScreenBytes(x, y, width, height int) ([]byte, error)

CaptureScreenBytes captures a screenshot and returns it as PNG bytes

func (*X11Client) ClickMouse

func (c *X11Client) ClickMouse(button string, clicks int) error

ClickMouse performs a mouse click at the current cursor position

func (*X11Client) Close

func (c *X11Client) Close()

Close closes the X11 connection

func (*X11Client) GetCursorPosition

func (c *X11Client) GetCursorPosition() (int, int, error)

GetCursorPosition returns the current cursor position

func (*X11Client) GetScreenDimensions

func (c *X11Client) GetScreenDimensions() (int, int)

GetScreenDimensions returns the screen width and height

func (*X11Client) MoveMouse

func (c *X11Client) MoveMouse(x, y int) error

MoveMouse moves the cursor to the specified absolute coordinates

func (*X11Client) ScrollMouse

func (c *X11Client) ScrollMouse(clicks int, direction string) error

ScrollMouse scrolls the mouse wheel For X11: button 4 = scroll up, button 5 = scroll down

button 6 = scroll left, button 7 = scroll right

func (*X11Client) SendKeyCombo

func (c *X11Client) SendKeyCombo(combo string) error

SendKeyCombo sends a key combination (e.g., "ctrl+c", "super+l")

func (*X11Client) TypeText

func (c *X11Client) TypeText(text string, delayMs int) error

TypeText types the given text with a configurable delay between keystrokes (in milliseconds)

Jump to

Keyboard shortcuts

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