gui

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 10 Imported by: ? 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

Overview

Package gui provides Wayland/X11 adaptive desktop automation script generation and pure-Go screenshot downscaling for the MCP gui tool.

Index

Constants

View Source
const (
	ActionShot        = "shot"
	ActionClick       = "click"
	ActionDoubleClick = "double_click"
	ActionRightClick  = "right_click"
	ActionMove        = "move"
	ActionType        = "type"
	ActionKey         = "key"
	ActionScroll      = "scroll"
	ActionDrag        = "drag"

	MaxImageDimension = 1280
	JPEGQuality       = 75
	// CaptureOutputLimit bounds the base64 screenshot captured from the
	// remote script. It covers an uncompressed-ish 4K PNG (~25 MiB encoded).
	CaptureOutputLimit = 48 << 20
)

Variables

This section is empty.

Functions

func BuildScript

func BuildScript(req Request) (string, error)

BuildScript constructs a self-contained POSIX shell script that adapts to Wayland or X11, executes the action, waits 500ms on mutations, and outputs a base64-encoded screenshot between markers.

func ExtractAndProcessImage

func ExtractAndProcessImage(output string) ([]byte, string, error)

ExtractAndProcessImage extracts the base64 screenshot payload from script output and downscales/compresses it via ProcessImage.

func IsReadOnly

func IsReadOnly(action string) bool

IsReadOnly reports whether the GUI action does not mutate application state.

func ProcessImage

func ProcessImage(raw []byte) ([]byte, string, error)

ProcessImage limits the image's longest edge to 1280px and compresses as JPEG (quality 75) in pure Go. WebP payloads are passed through directly.

Types

type Request

type Request struct {
	Action  string
	Coord   []int
	Text    string
	Display string
}

Request describes a normalized GUI action.

func (Request) Validate

func (r Request) Validate() error

Validate checks action, coordinate bounds (0-1000), and required parameters.

Jump to

Keyboard shortcuts

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