sharepreview

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 6 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 sharepreview is the capture half of wayle-share-preview on top of lys-lib's capture package: turning captured frames into images (the output-transform correction, the preview downscale) and the XDPH window list the share picker reads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FrameImage

func FrameImage(f *capture.Frame, t capture.Transform) (*image.RGBA, error)

FrameImage converts a captured frame to an image and applies the output transform, the Image::new → into_rgb → transform chain of image.rs. Frames without alpha come out opaque.

func Resize

func Resize(src *image.RGBA, w, h int) *image.RGBA

Resize scales the image to w x h with a triangle (bilinear) filter, image's FilterType::Triangle.

func ResizeToFit

func ResizeToFit(src *image.RGBA, size int) *image.RGBA

ResizeToFit downscales the image so its smaller dimension is at most size, keeping the aspect ratio - image.rs's resize_to_fit, including its quirks: a portrait image scales when its width exceeds size, a landscape one when its height does, and a square image never scales.

func Transform

func Transform(img *image.RGBA, t capture.Transform) *image.RGBA

Transform applies an output transform to a captured frame the way image.rs's Image::transform does: the 90/270 variants rotate clockwise (image's rotate90/rotate270), and the flipped variants flip vertically first. TransformNormal returns img itself.

func TransformInto added in v0.2.0

func TransformInto(dst, src *image.RGBA, t capture.Transform)

TransformInto writes src with t applied into dst, for a caller that owns dst's memory; dst has src's TransformedSize.

func TransformedSize added in v0.2.0

func TransformedSize(w, h int, t capture.Transform) (int, int)

TransformedSize is the size of a w x h frame once t is applied.

Types

type Toplevel

type Toplevel struct {
	// ID is the XDPH toplevel id - its own wlr-foreign-toplevel resource
	// id, which only XDPH resolves - or a display-only index for
	// fallback entries.
	ID uint64
	// Class and Title are the window's class (app id) and title.
	Class, Title string
	// WindowAddress is the Hyprland window address when XDPH sent one
	// ([HA>]); zero with HasAddress false otherwise.
	WindowAddress uint64
	HasAddress    bool
	// Identifier is the stable ext-foreign-toplevel-list identifier of a
	// fallback entry, empty for XDPH entries (which use ID).
	Identifier string
}

Toplevel is one shareable window (toplevel.rs): an entry of the XDPH_WINDOW_SHARING_LIST xdg-desktop-portal-hyprland hands the share picker, or of the generic ext-foreign-toplevel-list fallback.

func ParseList

func ParseList(list string) []Toplevel

ParseList parses an XDPH_WINDOW_SHARING_LIST value (`<id>[HC>]<class>[HT>]<title>[HE>]<address>[HA>]...`, see XDPH's ScreencopyShared.cpp). The address field is optional for older Hyprland releases. Parsing stops at the first malformed entry, keeping what came before, and logs why - toplevel.rs's behavior, including its reading of separators from the start of the remaining text.

Jump to

Keyboard shortcuts

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