inspect

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 13 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

Overview

The doctor diagnostics block: one line block a bug report carries verbatim ("here is my lys-ui doctor output"), covering the session's bound globals and their versions, outputs and scales, the resolved cursor theme, the fonts sysfont selected, and the shm buffer format. Everything is read-only snapshot data; the app prints it at startup behind a flag, and nothing here requires the inspector to be armed.

Package inspect is lys-ui's debug inspector (the GTK-inspector counterpart): a widget-tree overlay drawn over the live UI, the tree dump for bug reports, and the doctor diagnostics block.

Prod visibility: everything here is always compiled in but inert until asked for - LYS_UI_INSPECT=1 at startup, an explicit Application.SetInspect/ToggleInspect call, or (for the dump and doctor) an explicit call. With the inspector off, an app pays one passthrough call per frame operation and one bool check per key press; nothing traces, draws, or allocates. The lysdebug build tag was deliberately NOT used: the inspector exists to debug prod binaries in the field, where tagged builds do not exist. Real trace instrumentation stays behind the tag (internal/debug).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Doctor

func Doctor(sess *wlsession.Session, opts DoctorOptions) string

Doctor renders the diagnostics block from a live session. A nil session formats the non-session lines (fonts, buffer) and marks the session lines unavailable, so a doctor run before Connect still produces the block.

func DoctorFrom

func DoctorFrom(info wlsession.InspectInfo, opts DoctorOptions) string

DoctorFrom renders the diagnostics block from a session snapshot. The format is stable: tests pin every line's shape, so tooling (and humans skimming an issue) can rely on it.

func Dump

func Dump(root widget.Widget, r *widget.Router) string

Dump renders the tree dump for bug reports: one banner line, then the stable widget.DumpTree format (one indented line per widget with type, debug name, bounds, role, tooltip, and input-state flags). Print it to stdout on demand; the exact bytes are pinned by tests, so a dump in an issue means the same thing to everyone.

func Enabled

func Enabled() bool

Enabled reports whether the environment asked for the inspector at startup: LYS_UI_INSPECT set to 1, true, yes, or on (case-insensitive). Anything else - unset, empty, 0, off - leaves it off.

func PaintAnnotations

func PaintAnnotations(cv *render.Canvas, nodes []widget.NodeInfo)

PaintAnnotations draws the inspector overlay for a snapshot taken with widget.InspectTree: per-widget bounds with an alternating tint per depth, a name/type label chip, the hovered subtree washed stronger, and the router's hover and focus targets outlined in their own colors. It only reads the snapshot and draws; it never touches widget state, so tests can pin it as side-effect free.

func SetLabelFont

func SetLabelFont(f *render.Typeface)

SetLabelFont overrides the face overlay labels use.

Types

type DoctorOptions

type DoctorOptions struct {
	// Sans and Mono name the resolved default faces; empty resolves
	// them through sysfont.Sans/Monospace at format time.
	Sans, Mono string
}

DoctorOptions carries the doctor's overridable inputs. Empty fields mean "resolve it yourself": the font names come from sysfont's default resolution.

type Overlay

type Overlay struct {
	widget.Base
	// contains filtered or unexported fields
}

Overlay wraps a widget tree and paints inspector annotations over it: bounds with a per-depth alternating tint, the debug name or type as a label, the hovered subtree, the router's hover target, and the focus target, each marked distinctly.

The overlay is transparent plumbing while it is off: Measure, Arrange, HitTest, and the tree walks all pass straight through to the wrapped root, so wrapping never changes layout, hit testing, or damage. Painting annotations only reads state (widget.InspectTree); it never invalidates or mutates a widget. It is a node in the parent chain, though: the root's invalidations climb through it to the window's caches, which a parentless root would cut off.

func NewOverlay

func NewOverlay(root widget.Widget) *Overlay

NewOverlay wraps root. The overlay starts off; SetOn turns the annotations on. It never wraps nil: a nil root passes through as a harmless empty widget.

func (*Overlay) Arrange

func (o *Overlay) Arrange(r render.Rect)

Arrange implements widget.Widget, passing through to the root and parenting it.

func (*Overlay) Children

func (o *Overlay) Children() []widget.Widget

Children exposes the wrapped root, so tree walks (damage collection, focus traversal) see the real tree.

func (*Overlay) HitTest

func (o *Overlay) HitTest(p widget.Point) widget.Widget

HitTest implements widget.Widget, passing through to the root so input routing lands on real widgets, never on the overlay.

func (*Overlay) Measure

func (o *Overlay) Measure(axis widget.Axis, forSize int) widget.Sizes

Measure implements widget.Widget, passing through to the root.

func (*Overlay) On

func (o *Overlay) On() bool

On reports whether annotations are painted.

func (*Overlay) Paint

func (o *Overlay) Paint(cv *render.Canvas)

Paint implements widget.Widget: the root paints first, then the annotations when the overlay is on. The annotation pass is a pure function of widget state - no invalidation, no state changes.

func (*Overlay) Root

func (o *Overlay) Root() widget.Widget

Root returns the wrapped widget tree.

func (*Overlay) SetOn

func (o *Overlay) SetOn(on bool)

SetOn turns the annotation painting on or off.

func (*Overlay) SetRouter

func (o *Overlay) SetRouter(r *widget.Router)

SetRouter attaches the router whose focus, hover, and press targets the overlay marks. The app installs its window's router right after creating it.

Jump to

Keyboard shortcuts

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