contract

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 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

View Source
const (
	ExitSuccess      = 0
	ExitGeneric      = 1
	ExitValidation   = 2
	ExitNotFound     = 3
	ExitDependency   = 4
	ExitPrecondition = 5
	ExitCancelled    = 6
)
View Source
const (
	CoordSpaceScreen      = "screen"
	CoordSpaceScreenshot  = "screenshot"
	CoordSpaceWindow      = "window"
	CoordSpaceWindowFrame = "window_frame"
	CoordSpaceMonitor     = "monitor"
)

Coordinate spaces. Every Point carries one of these in its Space field. The Resolve() helper is the single conversion site that turns a Point in any space into absolute screen coordinates.

View Source
const (
	FindSourceOCR      = "ocr"
	FindSourceTemplate = "template"
	FindSourceColor    = "color"
	FindSourceATSPI    = "atspi"
)

Find-result sources. The set is declared here so task-3 and task-4 can land find_text, find_template, find_color, and find_atspi primitives that return FindResult without further surface changes.

View Source
const SchemaVersion = "0.2"

SchemaVersion is the current action-payload schema version that this build of MyComputer speaks. Every computer_actions request and response must carry this value at the top level. Bumped only on breaking changes to the request/response envelopes.

View Source
const WindowGeometryDivergedCode = "WINDOW_GEOMETRY_DIVERGED"

WindowGeometryDivergedCode is emitted as a warning (not error) in ActionResult.Details when a window verb's post-op WM-reported client_bounds disagrees with the actually-rendered surface — typical of immediate-mode toolkits (Gio, Dear ImGui, Flutter-Linux, egui) that do not react to ConfigureNotify, leaving the WM-reported bounds containing exposed desktop wallpaper instead of app content.

Detection samples a 50x50 patch at the bottom-right interior corner of client_bounds and compares it to the root window's dominant background color; >=70% root-color hits flips the warning. The action remains ok:true. Joins the WINDOW_GEOMETRY_REFUSED family of advisory warnings; the agent should fall back to find_color / find_text targeting instead of trusting WM coordinates.

View Source
const WindowGeometryRefusedCode = "WINDOW_GEOMETRY_REFUSED"

WindowGeometryRefusedCode is emitted as a warning (not error) in ActionResult.Details when a window verb's post-op geometry diverges from the requested geometry beyond a small tolerance — typically a tiling WM (i3/bspwm/sway-X11) refusing to honor floating geometry. The action result remains ok:true; the agent decides recovery.

Variables

This section is empty.

Functions

func ErrorCode

func ErrorCode(err error) int

func MarshalError

func MarshalError(err error) []byte

func MatchWindowInfo

func MatchWindowInfo(win WindowInfo, target WindowTarget) bool

MatchWindowInfo reports whether a window satisfies a WindowTarget. Exported so the window package can share the matcher with focus_window and the window_* verbs. ID matching is exact (hex or decimal); PID is numeric equality; Class is case-insensitive exact; Title is case-insensitive substring. If more than one selector is set, all non-empty selectors must match (logical AND).

func Resolve

func Resolve(p Point, rctx ResolveContext) (int, int, error)

Resolve is the single internal entry point that converts a Point in any declared coordinate space into absolute screen coordinates. Every click/move/drag/scroll/screenshot handler MUST route coordinate translation through this helper — direct use of CoordMap.MapPoint or manual arithmetic is a layering violation.

Behavior:

  • space "" or "screen": returns (X, Y) unchanged.
  • space "screenshot": requires a CoordMap string captured from a prior screenshot response; maps image-space pixels to screen pixels. Preserves v0.1 wire compatibility.
  • space "window": requires Target and a non-empty ResolveContext.Windows. Translates relative to the matched window's client_bounds (decorations excluded). Coordinates are clamped to client_bounds; out-of-bounds is a validation error.
  • space "window_frame": same as "window" but uses the matched window's outer screen bounds (decorations included). Intended for clicking custom titlebars in Gio/ImGui apps.
  • space "monitor": requires MonitorIndex and a non-empty ResolveContext.Monitors. Translates relative to that monitor's bounds; clamped to those bounds.

Any unknown space is a hard validation error.

func SupportedSchemaVersions

func SupportedSchemaVersions() []string

SupportedSchemaVersions enumerates every schema version this server accepts on inbound requests. Requests without a schema_version field at all are rejected with VALIDATION_SCHEMA_VERSION_REQUIRED; an explicit "0.1" is accepted for clients that have started declaring the field but haven't migrated their action shapes yet. The current preferred version is SchemaVersion. v0.1 wire compatibility for screenshot responses (coord_map string) is preserved separately.

func ValidateSchemaVersion

func ValidateSchemaVersion(value string) error

ValidateSchemaVersion checks that the supplied value is a recognized action-payload schema version. Empty values are rejected with VALIDATION_SCHEMA_VERSION_REQUIRED (exit 2) and include a remediation hint pointing at the current supported set. Unrecognized non-empty values are rejected with VALIDATION_SCHEMA_VERSION_UNSUPPORTED.

Types

type ActionResult

type ActionResult struct {
	Action  string         `json:"action"`
	OK      bool           `json:"ok"`
	Backend string         `json:"backend,omitempty"`
	Details map[string]any `json:"details,omitempty"`
}

type AppError

type AppError struct {
	Code     string         `json:"code"`
	Message  string         `json:"message"`
	Details  map[string]any `json:"details,omitempty"`
	ExitCode int            `json:"-"`
}

func Cancelled

func Cancelled(message string) *AppError

func Dependency

func Dependency(code, message string, details map[string]any) *AppError

func NewError

func NewError(exit int, code, message string, details map[string]any) *AppError

func NotFound

func NotFound(code, message string, details map[string]any) *AppError

func Precondition

func Precondition(code, message string, details map[string]any) *AppError

func Validation

func Validation(code, message string, details map[string]any) *AppError

func (*AppError) Error

func (e *AppError) Error() string

type BackendStatus

type BackendStatus struct {
	Name      string         `json:"name"`
	Ready     bool           `json:"ready"`
	Required  bool           `json:"required"`
	Message   string         `json:"message,omitempty"`
	Details   map[string]any `json:"details,omitempty"`
	CheckedAt time.Time      `json:"checked_at"`
	// Capabilities is an optional, backend-defined list of capability
	// tokens (e.g. "read", "set_text" for AT-SPI). Empty for backends
	// that do not advertise capabilities. Added in v0.2; later tasks
	// populate per-backend values.
	Capabilities []string `json:"capabilities,omitempty"`
}

type Bounds

type Bounds struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

func ResolveRegion

func ResolveRegion(r RegionRef, rctx ResolveContext) (Bounds, error)

ResolveRegion is the single internal entry point that converts a RegionRef in any declared coordinate space into an absolute screen-space Bounds. Mirrors Resolve() for Points. Wrapper around ResolveRegionDetailed for callers that do not need the clamp metadata.

Behavior summary (see ResolveRegionDetailed for the full contract):

  • Space "" or "screen": returns the bare Bounds unchanged.
  • Space "window": requires Target and a non-empty ResolveContext.Windows. The rectangle is interpreted relative to the matched window's client_bounds (decorations excluded). Falls back to outer bounds when client_bounds are unknown.
  • Space "window_frame": same as "window" but anchored on the matched window's outer (frame-inclusive) bounds.
  • Space "monitor": requires MonitorIndex and a non-empty ResolveContext.Monitors. Rectangle is interpreted relative to that monitor's bounds.

Oversized regions are CLAMPED to the resolved-space bounds by default; set RegionRef.Strict=true to receive REGION_OUT_OF_BOUNDS instead. The returned Bounds is the *effective* rectangle (post-clamp in non-strict mode) in absolute screen coordinates.

A zero-sized RegionRef (Empty() == true) is returned as the full resolved-space rectangle so callers can use it as a "default to this window/monitor" shorthand. Any unknown space is a hard validation error. Any required-field validation (REGION_TARGET_REQUIRED, REGION_MONITOR_INDEX_REQUIRED) is also a hard validation error regardless of Strict.

func (Bounds) Contains

func (b Bounds) Contains(x, y int) bool

func (Bounds) Empty

func (b Bounds) Empty() bool

type BrowserPipelineResult

type BrowserPipelineResult struct {
	BrowserURL string            `json:"browser_url,omitempty"`
	URL        string            `json:"url,omitempty"`
	Title      string            `json:"title,omitempty"`
	Text       string            `json:"text,omitempty"`
	Screenshot string            `json:"screenshot,omitempty"`
	Steps      []ActionResult    `json:"steps"`
	Values     map[string]string `json:"values,omitempty"`
}

type ConfigReport

type ConfigReport struct {
	Product           string            `json:"product"`
	ConfigFiles       []string          `json:"config_files"`
	LoadedConfig      string            `json:"loaded_config,omitempty"`
	Values            map[string]Value  `json:"values"`
	AvailableBackends map[string]string `json:"available_backends"`
}

type CoordMap

type CoordMap struct {
	CaptureX      int `json:"capture_x"`
	CaptureY      int `json:"capture_y"`
	CaptureWidth  int `json:"capture_width"`
	CaptureHeight int `json:"capture_height"`
	ImageWidth    int `json:"image_width"`
	ImageHeight   int `json:"image_height"`
}

func NewCoordMap

func NewCoordMap(capture Bounds, image Size) CoordMap

func ParseCoordMap

func ParseCoordMap(value string) (CoordMap, error)

func (CoordMap) MapPoint

func (m CoordMap) MapPoint(x, y int) (int, int, error)

func (CoordMap) String

func (m CoordMap) String() string

type CoordSpace

type CoordSpace = string

CoordSpace is a typed string alias for the coordinate-space enum. Stored as plain string in Point.Space for JSON round-tripping; this type is for internal type-safety where it matters.

type DecorationInsets

type DecorationInsets struct {
	Left   int `json:"left"`
	Top    int `json:"top"`
	Right  int `json:"right"`
	Bottom int `json:"bottom"`
}

DecorationInsets describes the WM frame extents around a window. Values are zero when _NET_FRAME_EXTENTS is unavailable.

func (DecorationInsets) IsZero

func (d DecorationInsets) IsZero() bool

IsZero reports whether all four insets are zero (or negative).

type DoctorReport

type DoctorReport struct {
	Product   string          `json:"product"`
	Version   VersionInfo     `json:"version"`
	Session   SessionInfo     `json:"session"`
	Readiness Readiness       `json:"readiness"`
	Backends  []BackendStatus `json:"backends"`
	// SchemaVersions enumerates every action-payload schema version this
	// server can accept on inbound computer_actions requests. The list
	// is MANDATORY in doctor output — never empty, never omitted.
	SchemaVersions []string `json:"schema_versions"`
	AvailableTools []string `json:"available_tools"`
}

type ErrorEnvelope

type ErrorEnvelope struct {
	Error *AppError `json:"error"`
}

type FindCandidate

type FindCandidate struct {
	Bounds     Bounds         `json:"bounds"`
	Confidence float64        `json:"confidence"`
	Source     string         `json:"source" jsonschema:"ocr, template, color, or atspi"`
	Extra      map[string]any `json:"extra,omitempty"`
}

FindCandidate is one hit returned by a find_* primitive. The shape is intentionally minimal: bounds in screen space, a confidence score in [0, 1], a source tag, and an open extras bag for source-specific detail (e.g., OCR text, template name, AT-SPI element id). Consumed by task-3 and task-4.

type FindResult

type FindResult struct {
	Candidates   []FindCandidate `json:"candidates"`
	SearchRegion Bounds          `json:"search_region"`
	CoordSpace   string          `json:"coord_space" jsonschema:"always screen for find results"`
	// RegionClamped reports that the request asked for a search region
	// larger than the resolved-space bounds and the find primitive
	// silently shrunk it to fit. Omitted when no clamp occurred so
	// existing in-bounds calls return the same wire shape.
	RegionClamped bool `json:"region_clamped,omitempty"`
	// OriginalRegion is the local (pre-resolution) rectangle the caller
	// requested. Present only when RegionClamped is true.
	OriginalRegion *Bounds `json:"original_region,omitempty"`
	// ClampedRegion is the local (pre-resolution) rectangle actually
	// searched after the clamp. Present only when RegionClamped is true.
	ClampedRegion *Bounds `json:"clamped_region,omitempty"`
}

FindResult is the envelope every find_* primitive returns. Candidates are sorted by confidence descending, then top-to-bottom, then left-to-right. CoordSpace is always "screen" — find primitives translate into screen coordinates before returning so callers can hand bounds straight to click/move without further conversion.

type MonitorInfo

type MonitorInfo struct {
	// Index is the zero-based position of this monitor in the
	// get_screen_info / observe monitor list. Stable for the lifetime
	// of one process call; agents reference it via
	// point.target.monitor_index when point.space="monitor".
	Index int `json:"index"`
	// Name is the RandR monitor name (e.g. "DP-1", "eDP-1"). Empty
	// when RandR is unavailable or the monitor atom is unset.
	Name string `json:"name,omitempty"`
	// Bounds is the monitor rectangle in physical X11 pixels.
	Bounds Bounds `json:"bounds"`
	// Scale is the informational DPI scale factor (96 DPI = 1.0).
	// Always > 0; defaults to 1.0 when RandR does not expose
	// millimeter dimensions. MyComputer always operates in physical
	// pixels — this field exists so agents can translate between
	// app-reported logical coordinates and physical XTest
	// coordinates when needed.
	Scale float64 `json:"scale"`
	// Primary reports whether this monitor is the X primary. Exactly
	// one monitor is primary on a healthy multi-monitor setup;
	// single-monitor systems always report primary:true for the one
	// monitor.
	Primary bool `json:"primary"`
	// RefreshHz is the refresh rate in hertz, rounded to the nearest
	// integer. Zero when the refresh rate cannot be determined.
	RefreshHz int `json:"refresh_hz,omitempty"`
}

type ObserveResult

type ObserveResult struct {
	Screen        ScreenInfo        `json:"screen"`
	FocusedWindow *WindowInfo       `json:"focused_window,omitempty"`
	Windows       []WindowInfo      `json:"windows,omitempty"`
	Cursor        *Point            `json:"cursor,omitempty"`
	Screenshot    *ScreenshotResult `json:"screenshot,omitempty"`
	Accessibility map[string]any    `json:"accessibility,omitempty"`
	Backends      map[string]string `json:"backends,omitempty"`
}

type Point

type Point struct {
	X            int          `json:"x"`
	Y            int          `json:"y"`
	Space        string       `json:"space,omitempty" jsonschema:"screen, screenshot, window, window_frame, or monitor"`
	CoordMap     string       `json:"coord_map,omitempty" jsonschema:"coordinate map returned by a screenshot response; required when space=screenshot"`
	Target       WindowTarget `json:"target,omitzero" jsonschema:"window selector; required when space=window or window_frame"`
	MonitorIndex *int         `json:"monitor_index,omitempty" jsonschema:"zero-based monitor index; required when space=monitor"`
}

func (Point) ScreenPoint

func (p Point) ScreenPoint() (int, int, error)

ScreenPoint resolves a Point with an empty ResolveContext. It is a thin convenience wrapper around Resolve for call sites that only handle the screen and screenshot spaces today. Call sites that need to support window or monitor spaces must call Resolve directly with a populated ResolveContext.

type Readiness

type Readiness struct {
	Status     string   `json:"status"`
	Blockers   []string `json:"blockers,omitempty"`
	Warnings   []string `json:"warnings,omitempty"`
	NextAction string   `json:"next_action,omitempty"`
}

type RegionRef

type RegionRef struct {
	X            int          `json:"x"`
	Y            int          `json:"y"`
	Width        int          `json:"width"`
	Height       int          `json:"height"`
	Space        string       `json:"space,omitempty" jsonschema:"screen (default), window, window_frame, or monitor"`
	Target       WindowTarget `json:"target,omitzero" jsonschema:"window selector; required when space=window or window_frame"`
	MonitorIndex *int         `json:"monitor_index,omitempty" jsonschema:"zero-based monitor index; required when space=monitor"`
	// Strict makes ResolveRegion fail-loudly with REGION_OUT_OF_BOUNDS
	// when the requested rectangle exceeds the resolved-space bounds
	// (window client_bounds, monitor bounds, or screen bounds). The
	// default (Strict=false) clamps to the available area and surfaces
	// the change via the resolve result's Clamped flag so the screenshot
	// / find_* / wait_for_* response can report region_clamped:true plus
	// the original and clamped local rectangles. Opt-in for callers that
	// want a hard validation error on oversized regions instead of a
	// silent clamp.
	Strict bool `` /* 193-byte string literal not displayed */
}

RegionRef is the coord-space-aware superset of Bounds used by every request that previously accepted a bare screen-space Bounds (find_*, wait_for_*, screenshot, etc.). On the wire the JSON shape is backward-compatible: a bare `{x, y, width, height}` payload (the v0.1 / v0.2 shape) deserializes into a RegionRef whose Space is "" and resolves as screen-space — no behavior change for existing clients.

The extended shape adds:

  • Space: "screen" (default), "window", "window_frame", or "monitor". Empty equals "screen".
  • Target: window selector — REQUIRED when Space is "window" or "window_frame". Mirrors Point.Target.
  • MonitorIndex: zero-based monitor index — REQUIRED when Space is "monitor". Mirrors Point.MonitorIndex.

Coordinate resolution: ResolveRegion turns a RegionRef into an absolute screen-space Bounds against the supplied ResolveContext (window/monitor lists). It is the single entry point for region translation; every consumer of an extended region MUST route through ResolveRegion before doing X11 work, so coord_map and downstream screen-space outputs remain consistent.

func RegionRefFromBounds

func RegionRefFromBounds(b Bounds) RegionRef

RegionRefFromBounds wraps a bare Bounds in a screen-space RegionRef. Convenience for internal call sites that already have a Bounds and want to flow through the RegionRef-shaped API.

func (RegionRef) Bounds

func (r RegionRef) Bounds() Bounds

Bounds returns the bare {x, y, width, height} portion of the RegionRef as a Bounds value. NOTE: this is the LOCAL (pre-resolution) rectangle — for window/monitor spaces it is relative to the window's or monitor's origin, NOT a screen-space rectangle. Use ResolveRegion when you need absolute screen coordinates.

func (RegionRef) Empty

func (r RegionRef) Empty() bool

Empty reports whether the RegionRef carries no usable size. Width or height <= 0 counts as empty so callers can use the same "fall back to default" pattern as Bounds.Empty.

type ResolveContext

type ResolveContext struct {
	// Windows is the snapshot of currently-visible windows. Required
	// when resolving Points whose Space is "window".
	Windows []WindowInfo
	// Monitors is the list of physical monitors in display order.
	// Required when resolving Points whose Space is "monitor".
	Monitors []MonitorInfo
}

ResolveContext carries the ambient information a coordinate-space resolver needs (active window list, monitor list, etc.) when translating a non-screen Point into absolute screen coordinates.

Tasks 2-7 will populate these fields. For task-1 the field set is declared so downstream resolvers can plug in without further surface changes.

type ResolveResult added in v0.3.4

type ResolveResult struct {
	// Bounds is the absolute screen-space rectangle.
	Bounds Bounds
	// Clamped reports whether ResolveRegionDetailed shrunk the requested
	// rectangle to fit the resolved-space bounds. Always false when
	// Strict was set on the request (Strict callers receive
	// REGION_OUT_OF_BOUNDS instead of a clamp).
	Clamped bool
	// OriginalRegion is the local (pre-resolution) rectangle the caller
	// asked for. Set when Clamped is true; zero-value otherwise.
	OriginalRegion Bounds
	// ClampedRegion is the local (pre-resolution) rectangle actually
	// used after the clamp. Set when Clamped is true; zero-value
	// otherwise.
	ClampedRegion Bounds
}

ResolveResult is the detailed return value of ResolveRegionDetailed. Bounds is the absolute screen-space rectangle suitable for XGetImage. When Clamped is true the requested rectangle exceeded the resolved-space bounds (window client_bounds, monitor bounds, or screen bounds) and was silently shrunk to fit; OriginalRegion records the originally-requested local rectangle and ClampedRegion records the local rectangle that was actually used. Both are in the local (pre-resolution) coordinate space — same shape as RegionRef.Bounds().

Callers that surface the clamp to the agent (screenshot, find_*, wait_for_*) should attach OriginalRegion and ClampedRegion under details.original_region and details.clamped_region next to the region_clamped:true flag so the agent sees the silent fix.

func ResolveRegionDetailed added in v0.3.4

func ResolveRegionDetailed(r RegionRef, rctx ResolveContext) (ResolveResult, error)

ResolveRegionDetailed converts a RegionRef in any declared coordinate space into a ResolveResult carrying the absolute screen-space bounds plus optional clamp metadata. This is the single entry point that every region-aware consumer (screen.Capture, find_text, find_image, find_color, wait_for_pixel_change, wait_for_text) should use; the older ResolveRegion is a thin wrapper that discards the clamp metadata for callers that do not surface it.

Clamp policy (v0.3.4):

  • When RegionRef.Strict is false (the default), an oversized request (negative offset OR offset+extent past the resolved-space bounds) is clamped to the available area. The result reports Clamped=true, OriginalRegion (local rect requested), and ClampedRegion (local rect after clamp). Surface these to the agent under details.region_clamped / details.original_region / details.clamped_region.

  • When RegionRef.Strict is true, the same condition returns REGION_OUT_OF_BOUNDS as before — preserves the fail-loudly path for callers that prefer it.

Required-field validation (REGION_TARGET_REQUIRED, REGION_MONITOR_INDEX_REQUIRED), missing-target precondition (WINDOW_NOT_FOUND, WINDOW_AMBIGUOUS), unknown-bounds (WINDOW_BOUNDS_UNKNOWN, MONITOR_BOUNDS_UNKNOWN), and bad-space validation (INVALID_COORDINATE_SPACE) are always hard errors regardless of Strict.

type ScreenInfo

type ScreenInfo struct {
	Bounds   Bounds        `json:"bounds"`
	Monitors []MonitorInfo `json:"monitors,omitempty"`
	Backend  string        `json:"backend"`
}

type ScreenshotResult

type ScreenshotResult struct {
	ImagePath     string `json:"image_path"`
	MimeType      string `json:"mime_type"`
	CaptureBounds Bounds `json:"capture_bounds"`
	ImageSize     Size   `json:"image_size"`
	CoordMap      string `json:"coord_map"`
	Backend       string `json:"backend"`
	// RegionClamped reports that the request asked for a region larger
	// than the resolved-space bounds (window client_bounds, monitor
	// bounds, or screen bounds) and the capture was silently shrunk to
	// fit. Field is omitted when no clamp occurred so existing
	// in-bounds calls return the same wire shape as before.
	RegionClamped bool `json:"region_clamped,omitempty"`
	// OriginalRegion is the local (pre-resolution) rectangle the caller
	// requested. Present only when RegionClamped is true. For window-
	// and monitor-space requests this is the rectangle relative to the
	// window or monitor origin; for screen-space requests it equals
	// the original {x,y,width,height} from the request.
	OriginalRegion *Bounds `json:"original_region,omitempty"`
	// ClampedRegion is the local (pre-resolution) rectangle actually
	// used after the clamp. Present only when RegionClamped is true.
	ClampedRegion *Bounds `json:"clamped_region,omitempty"`
}

type SessionInfo

type SessionInfo struct {
	Display        string `json:"display,omitempty"`
	XAuthority     string `json:"xauthority,omitempty"`
	XDGSessionType string `json:"xdg_session_type,omitempty"`
	WaylandDisplay string `json:"wayland_display,omitempty"`
	Desktop        string `json:"desktop,omitempty"`
	// RespectUser is the resolved value of the --respect-user flag (or
	// MYCOMPUTER_RESPECT_USER env var, or config value). When true, the
	// agent should yield input to the human user when the user is
	// actively interacting with the desktop. Actual yield behavior is
	// implemented in task-6 (see contract.outOfScope for task-1); this
	// field is the declaration that surfaces the resolved setting. The
	// field is MANDATORY in doctor output — always present.
	RespectUser bool `json:"respect_user"`
	// AllowClose is the resolved value of the --allow-close flag. When
	// true, window_close actions issued in this process are permitted;
	// when false (the default), window_close returns
	// PRECONDITION_CLOSE_NOT_ALLOWED. v0.2 keeps this gated; the field
	// is MANDATORY in doctor output — always present.
	AllowClose bool `json:"allow_close"`
	// LogicalCoords is the resolved value of the --logical-coords flag
	// (also env MYCOMPUTER_LOGICAL_COORDS / config logical_coords). When
	// true MyComputer translates input/output coordinates by the primary
	// monitor's RandR scale; off by default. The field is MANDATORY in
	// doctor output — always present.
	LogicalCoords bool `json:"logical_coords"`
}

type Size

type Size struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

type Value

type Value struct {
	Value  any    `json:"value"`
	Source string `json:"source"`
}

type VersionInfo

type VersionInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Built   string `json:"built"`
	Go      string `json:"go,omitempty"`
}

type WindowInfo

type WindowInfo struct {
	ID      string `json:"id"`
	XID     uint32 `json:"xid"`
	Title   string `json:"title,omitempty"`
	Class   string `json:"class,omitempty"`
	PID     uint32 `json:"pid,omitempty"`
	Focused bool   `json:"focused"`
	// Bounds is the outer (frame-inclusive, screen-space) window
	// rectangle. Preserved unchanged from v0.1 for wire compatibility.
	Bounds Bounds `json:"bounds"`
	// ClientBounds is the inner (decoration-excluded, screen-space)
	// rectangle. This is the default origin used when resolving a Point
	// whose Space is "window". When _NET_FRAME_EXTENTS is unavailable
	// the value equals Bounds.
	ClientBounds Bounds `json:"client_bounds"`
	// DecorationInsets is the WM frame inset (left, top, right, bottom)
	// derived from _NET_FRAME_EXTENTS. All zeros when the property is
	// not advertised by the WM (e.g., tiling WMs without decorations).
	DecorationInsets DecorationInsets `json:"decoration_insets"`
}

type WindowTarget

type WindowTarget struct {
	ID    string `json:"id,omitempty" jsonschema:"hex or decimal X11 window id"`
	Title string `json:"title,omitempty" jsonschema:"case-insensitive substring match against window title"`
	Class string `json:"class,omitempty" jsonschema:"case-insensitive exact match against WM_CLASS"`
	PID   uint32 `json:"pid,omitempty" jsonschema:"process id"`
}

WindowTarget identifies a window for matching/resolution. At least one of the fields must be non-zero; the matcher walks ID > PID > Class > Title in declaration order. Used by focus_window, by every window_* verb, and by Point.Target when point.space="window" or "window_frame". JSON shape matches the existing focus_window input.

func (WindowTarget) Empty

func (t WindowTarget) Empty() bool

Empty reports whether the target carries no selectable criteria.

Jump to

Keyboard shortcuts

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