window

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: 11 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

func EstimateRenderedBounds added in v0.3.1

func EstimateRenderedBounds(info contract.WindowInfo) (contract.Bounds, bool)

EstimateRenderedBounds returns a best-effort inner rectangle where the window's rendered surface stops, based on the texture-aware patch-vs-desktop heuristic used by detectGeometryDivergence. Exported so the `windows --detect-rendered` flag can attach a `rendered_bounds_estimate` to each window record. Returns the input bounds (and ok=false) when the heuristic cannot run (undecidable desktop, sampling failure) or when no divergence is detected.

func Focus

func Focus(ctx context.Context, target Target) (contract.WindowInfo, error)

func Focused

func Focused(ctx context.Context) (*contract.WindowInfo, error)

func List

func List(ctx context.Context) ([]contract.WindowInfo, error)

func SupportedAtoms

func SupportedAtoms(ctx context.Context) (map[string]bool, error)

SupportedAtoms reads _NET_SUPPORTED from the root window and returns the set of atom names the WM advertises. Used by diagnostic.x11 to populate the EWMH capability list.

Types

type MaximizeRequest

type MaximizeRequest struct {
	Target Target `json:"target"`
	Axis   string `json:"axis,omitempty" jsonschema:"both, horz, or vert; defaults to both"`
}

MaximizeRequest describes a window_maximize action.

type MoveRequest

type MoveRequest struct {
	Target Target `json:"target"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
}

MoveRequest describes a window_move action.

type ResizeRequest

type ResizeRequest struct {
	Target Target `json:"target"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

ResizeRequest describes a window_resize action.

type Target

type Target = contract.WindowTarget

Target is the WM-agnostic window selector used by focus_window and every window_* verb. It mirrors contract.WindowTarget exactly so internal callers can use either name; the alias keeps task-1's wire shape on Action.Target and Point.Target unified with the focus_window input.

type VerbResult

type VerbResult struct {
	Window  contract.WindowInfo `json:"window"`
	Notes   []string            `json:"notes,omitempty"`
	Warning *VerbWarning        `json:"warning,omitempty"`
}

VerbResult captures the post-op window plus any warning notes the verb produced (e.g. WINDOW_GEOMETRY_REFUSED).

func Close

func Close(ctx context.Context, target Target) (VerbResult, error)

Close requests window closure via _NET_CLOSE_WINDOW. CLI/MCP-layer callers must gate this behind --allow-close (or the batch-level allow_close flag); this function itself is unconditional so unit tests and audit paths can exercise it.

func Maximize

func Maximize(ctx context.Context, req MaximizeRequest) (VerbResult, error)

Maximize toggles the maximized state on the requested axis (both, horz, vert). Defaults to both.

func Minimize

func Minimize(ctx context.Context, target Target) (VerbResult, error)

Minimize iconifies the window via WM_CHANGE_STATE (IconicState=3). EWMH's _NET_WM_STATE_HIDDEN is read-only per spec, so the legacy WM_CHANGE_STATE client message is the correct hammer.

func Move

func Move(ctx context.Context, req MoveRequest) (VerbResult, error)

Move performs window_move via _NET_MOVERESIZE_WINDOW with static gravity. Post-op compares the new outer bounds against the request; a divergence beyond geometryTolerance raises WINDOW_GEOMETRY_REFUSED.

func Raise

func Raise(ctx context.Context, target Target) (VerbResult, error)

Raise activates and stacks the window above its siblings. Uses _NET_ACTIVE_WINDOW then falls back to ConfigureWindow+stack-above.

func Resize

func Resize(ctx context.Context, req ResizeRequest) (VerbResult, error)

Resize performs window_resize via _NET_MOVERESIZE_WINDOW.

func Workspace

func Workspace(ctx context.Context, req WorkspaceRequest) (VerbResult, error)

Workspace moves the window to the desktop at the given zero-based index via _NET_WM_DESKTOP.

type VerbWarning

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

VerbWarning is a structured non-fatal warning attached to a verb result. ok:true on the action; the agent decides recovery.

type WorkspaceRequest

type WorkspaceRequest struct {
	Target Target `json:"target"`
	Index  int    `json:"index"`
}

WorkspaceRequest describes a window_workspace action.

Jump to

Keyboard shortcuts

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