Documentation
¶
Overview ¶
Package sharepreview is the capture half of wayle-share-preview on top of lys-ui's capture package: turning captured frames into images (the output-transform correction, the preview downscale), the XDPH window list the share picker reads, and the best-effort gbm dmabuf allocator the screencast producer's zero-copy path imports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FrameImage ¶
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 ¶
Resize scales the image to w x h with a triangle (bilinear) filter, image's FilterType::Triangle.
func ResizeToFit ¶
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.
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 ¶
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.