regionoverlay

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 13 Imported by: 1 module, 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 regionoverlay is the region selection overlay: a layer surface on every monitor, a dim wash with a transparent hole where the selection overlaps that monitor, an accent border with resize handles, and a "W × H" size label. A drag draws the selection and a plain click picks the window (else the output) under the pointer; the selection is then moved, resized from its edges and corners or nudged with the arrow keys until Enter or a double-click confirms it. Everything is tracked in global (compositor-layout) logical coordinates, so a selection can span monitors. The screenshot host passes frozen per-output frames, which the surfaces paint behind the wash (freeze-frame) with a magnifier at the pointer; the share picker passes none, so the live screen shows through.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {
	Connector           string
	X, Y, Width, Height int
}

Monitor is one output's connector name and global logical geometry.

func MonitorOf

func MonitorOf(o *app.Output) Monitor

MonitorOf reads an output's logical geometry: the xdg-output position and size, falling back to the mode divided by the scale when the compositor reported no logical size.

type Overlay

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

Overlay is the overlay component. Request is its only entry point; everything else runs on the lys-ui loop goroutine.

func New

func New(a *app.Application, outputs func() []*app.Output, windows func() []image.Rectangle, font render.Font, sheet *widget.Stylesheet) *Overlay

New builds the overlay on the application; outputs lists the monitors to cover at each request, windows (nil for none) the windows a click can pick.

func (*Overlay) Cancel

func (o *Overlay) Cancel()

Cancel answers the open request, if any, as cancelled and takes the surfaces down. Call it from any goroutine but the loop's.

func (*Overlay) Request

func (o *Overlay) Request(frames map[string]render.StillImage) (Selection, bool)

Request opens the overlay and blocks until the user confirms a region (ok) or cancels with Escape (not ok). frames maps connector names to frozen frames painted behind the wash; nil or a missing connector leaves that surface transparent over the live screen. A request arriving while one is open cancels the older one. Call it from any goroutine but the loop's.

type Selection

type Selection struct {
	// Output is the connector name of the output the selection is
	// relative to.
	Output              string
	X, Y, Width, Height int
}

Selection is a region the user dragged, in logical pixels relative to Output: slurp's `<output>@x,y,w,h` and the screencopy region semantics.

Jump to

Keyboard shortcuts

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