lys-lib

module
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

README

lys-lib

lys-lib

The lys family's building blocks that are not widgets: what lys-ui draws with and what lys-shell talks to the system through.

Documentation

  • Rendering: the 2D canvas and its CPU and Vulkan renderers.
  • GPU: Vulkan devices, exportable dmabufs, and H.264/H.265 encoding.
  • Media: MP4/Matroska muxing, the Opus encoder, PCM mixing and V4L2 webcam capture.
  • Wayland: screen capture, virtual input and the protocol bindings they use.
  • System services: the PipeWire native-protocol client, the EIS server, and D-Bus on a patched godbus.

Pure Go, CGO_ENABLED=0. Native libraries are dlopened at run time only where the system provides the API: libvulkan, and optionally libva and libva-drm for video encoding.

Install

go get github.com/stubbedev/lys-lib@main

Usage

Each package is imported on its own. This draws on the CPU and writes a PNG:

package main

import (
	"image/png"
	"log"
	"os"

	"github.com/stubbedev/lys-lib/render"
)

func main() {
	const width, height = 320, 120
	stride := render.Stride(width)
	pixels := make([]byte, stride*height)

	cv := render.New(pixels, stride, width, height)
	cv.Clear(cv.Rect(), render.RGB(0x1f, 0x21, 0x36))
	cv.FillRect(render.Rect{X: 40, Y: 40, W: 240, H: 40}, render.RGB(0xff, 0xb4, 0x54))

	out, err := os.Create("out.png")
	if err != nil {
		log.Fatal(err)
	}
	defer out.Close()
	if err := png.Encode(out, render.NRGBA(pixels, stride, width, height)); err != nil {
		log.Fatal(err)
	}
}

Documentation

stubbedev.github.io/lys-lib has the package map, a page per domain, the third-party patch policy and the development gates. The API reference is on pkg.go.dev.

The lys family

lys-shell, lys-wm, lys-ui, lys-login, lys-splash, lys-polkit and lys-secrets.

Directories

Path Synopsis
Package atomicfile replaces files whole and durably: the content goes to a uniquely named temporary file beside the target, which is synced and renamed over it, and then the directory is synced so the rename survives a crash.
Package atomicfile replaces files whole and durably: the content goes to a uniquely named temporary file beside the target, which is synced and renamed over it, and then the directory is synced so the rename survives a crash.
Package audiomix sums several sources of interleaved 16-bit PCM into one stream, sample by sample with clipping, padding with silence what a source has not delivered yet.
Package audiomix sums several sources of interleaved 16-bit PCM into one stream, sample by sample with clipping, padding with silence what a source has not delivered yet.
Package capture copies screen contents out of the compositor: whole outputs and output regions through wlr-screencopy, single windows through ext-image-copy-capture (with the ext-foreign-toplevel-list enumeration and its capture sources) or Hyprland's toplevel-export, and continuous damage-driven output capture through an ext-image-copy-capture session (Stream).
Package capture copies screen contents out of the compositor: whole outputs and output regions through wlr-screencopy, single windows through ext-image-copy-capture (with the ext-foreign-toplevel-list enumeration and its capture sources) or Hyprland's toplevel-export, and continuous damage-driven output capture through an ext-image-copy-capture session (Stream).
Package clib is the shared purego plumbing for the native libraries the lys family binds without cgo (lys-login's libpam at run time, and the reference libpipewire and libei the tests here drive): dlopen over a candidate list and C string copies.
Package clib is the shared purego plumbing for the native libraries the lys family binds without cgo (lys-login's libpam at run time, and the reference libpipewire and libei the tests here drive): dlopen over a candidate list and C string copies.
Package dbustest runs private dbus-daemons for tests, so services that export or call D-Bus objects are exercised over a real bus without touching the user's session or system bus.
Package dbustest runs private dbus-daemons for tests, so services that export or call D-Bus objects are exercised over a real bus without touching the user's session or system bus.
Package dbusx holds the D-Bus plumbing every lys process shares, on lys-lib's patched godbus: exporting interfaces at a path and under a well-known name the way zbus's object_server().at + request_name does, serving zbus-style #[zbus(property)] getters (computed on every read) and setters over org.freedesktop.DBus.Properties, introspection built on demand, and watching a name for its owner.
Package dbusx holds the D-Bus plumbing every lys process shares, on lys-lib's patched godbus: exporting interfaces at a path and under a well-known name the way zbus's object_server().at + request_name does, serving zbus-style #[zbus(property)] getters (computed on every read) and setters over org.freedesktop.DBus.Properties, introspection built on demand, and watching a name for its owner.
Package debug is the lys family's compile-time trace facility.
Package debug is the lys family's compile-time trace facility.
Package dmabuf describes Linux dma-buf frames: GPU (or udmabuf) memory handed to the compositor by file descriptor through zwp_linux_dmabuf_v1, with no copy.
Package dmabuf describes Linux dma-buf frames: GPU (or udmabuf) memory handed to the compositor by file descriptor through zwp_linux_dmabuf_v1, with no copy.
Package dmabufprobe picks the DRM modifier a screencopy into GPU memory uses: the modifiers the compositor imports, ordered against the ones the device renders and exports, tried one at a time until a buffer allocates, imports and takes a frame.
Package dmabufprobe picks the DRM modifier a screencopy into GPU memory uses: the modifiers the compositor imports, ordered against the ones the device renders and exports, tried one at a time until a buffer allocates, imports and takes a frame.
Package dmabufwl builds zwp_linux_buffer_params_v1 objects from dmabuf descriptions, the step every linux-dmabuf import shares.
Package dmabufwl builds zwp_linux_buffer_params_v1 objects from dmabuf descriptions, the step every linux-dmabuf import shares.
Package drm issues DRM ioctls on a device node, in pure Go: KMS resources, connectors, planes, properties and blobs, dumb buffers, framebuffers and atomic commits, capabilities, and timeline syncobjs and sync files for explicit synchronization.
Package drm issues DRM ioctls on a device node, in pure Go: KMS resources, connectors, planes, properties and blobs, dumb buffers, framebuffers and atomic commits, capabilities, and timeline syncobjs and sync files for explicit synchronization.
Package edid reads a display's identity from its EDID: make, model and serial, as outputs are described and matched by.
Package edid reads a display's identity from its EDID: make, model and serial, as outputs are described and matched by.
Package eis is an EIS server: the receiving end of libei, which remote-desktop clients prefer over the portal's Notify* D-Bus calls.
Package eis is an EIS server: the receiving end of libei, which remote-desktop clients prefer over the portal's Notify* D-Bus calls.
Package fourcc names DRM pixel formats and format modifiers, as shared by the kernel, GBM, EGL and linux-dmabuf.
Package fourcc names DRM pixel formats and format modifiers, as shared by the kernel, GBM, EGL and linux-dmabuf.
Package golden compares rendered pixels against committed PNG snapshots ("goldens"), so render-level tests can assert byte-stable output on any machine.
Package golden compares rendered pixels against committed PNG snapshots ("goldens"), so render-level tests can assert byte-stable output on any machine.
Package gpu renders on the GPU through Vulkan, into memory shared with the compositor (or a display) as dmabufs: what a frame draws is handed over by file descriptor, with no copy.
Package gpu renders on the GPU through Vulkan, into memory shared with the compositor (or a display) as dmabufs: what a frame draws is handed over by file descriptor, with no copy.
Package gputest picks the Vulkan driver the GPU tests run on, from the environment: LYS_TEST_GPU=lavapipe runs them on Mesa's CPU driver (CI, no GPU needed), whose ICD file LYS_TEST_LAVAPIPE names (the dev shell sets it); any other value runs them on the host's device; unset, they run where a device is found and skip elsewhere.
Package gputest picks the Vulkan driver the GPU tests run on, from the environment: LYS_TEST_GPU=lavapipe runs them on Mesa's CPU driver (CI, no GPU needed), whose ICD file LYS_TEST_LAVAPIPE names (the dev shell sets it); any other value runs them on the host's device; unset, they run where a device is found and skip elsewhere.
Package intconv converts between integer types without silent wraparound: Exact refuses a value the target cannot hold, Must panics on one, Clamp saturates it, and Duration scales a count into a time.Duration.
Package intconv converts between integer types without silent wraparound: Exact refuses a value the target cannot hold, Must panics on one, Clamp saturates it, and Duration scales a count into a time.Duration.
internal
nal
Package nal writes H.264 and H.265 NAL units: the bit writer with Exp-Golomb codes the syntax uses, the escaping of start-code-like byte runs, and the parameter sets an encoder that does not write its own (VA-API's, given packed headers) puts in the stream.
Package nal writes H.264 and H.265 NAL units: the bit writer with Exp-Golomb codes the syntax uses, the escaping of start-code-like byte runs, and the parameter sets an encoder that does not write its own (VA-API's, given packed headers) puts in the stream.
nal/naltest
Package naltest reads H.264 and H.265 headers back through ffmpeg's trace_headers, for tests of what writes them.
Package naltest reads H.264 and H.265 headers back through ffmpeg's trace_headers, for tests of what writes them.
va
Package va drives VA-API's encoders without cgo: it loads libva and libva-drm at run time through purego, opens a display on a DRM render node, and wraps the calls H.264 and H.265 encoding makes.
Package va drives VA-API's encoders without cgo: it loads libva and libva-drm at run time through purego, opens a display on a DRM render node, and wraps the calls H.264 and H.265 encoding makes.
Package keymapfd reads the xkb keymap a wl_keyboard.keymap event carries.
Package keymapfd reads the xkb keymap a wl_keyboard.keymap event carries.
media
mux
Package mux writes timestamped H.264, H.265 and Opus samples into fragmented MP4 (NewMP4) and Matroska (NewMKV) files, in pure Go.
Package mux writes timestamped H.264, H.265 and Opus samples into fragmented MP4 (NewMP4) and Matroska (NewMKV) files, in pure Go.
opus
Package opus is a pure-Go Opus encoder (RFC 6716) for lys-shell's recordings: CELT-only fullband 20 ms frames (configuration 31) at a constant or constrained variable bitrate, from lys-ui's media PCM layout (48 kHz, interleaved signed 16-bit samples, one or two channels).
Package opus is a pure-Go Opus encoder (RFC 6716) for lys-shell's recordings: CELT-only fullband 20 ms frames (configuration 31) at a constant or constrained variable bitrate, from lys-ui's media PCM layout (48 kHz, interleaved signed 16-bit samples, one or two channels).
Package peercred reads the credentials of the process at the other end of a Unix socket, as the kernel recorded them when it connected.
Package peercred reads the credentials of the process at the other end of a Unix socket, as the kernel recorded them when it connected.
Package pipewire is the PipeWire video producer a ScreenCast portal streams through: a node exported over PipeWire's native protocol (a client-node, as libpipewire's pw_stream exports one), which drives its own graph: a cycle runs when a captured frame is ready, stamped with the header, transform and damage metas.
Package pipewire is the PipeWire video producer a ScreenCast portal streams through: a node exported over PipeWire's native protocol (a client-node, as libpipewire's pw_stream exports one), which drives its own graph: a cycle runs when a captured frame is ready, stamped with the header, transform and damage metas.
pwtest
Package pwtest starts a private PipeWire daemon for tests, so producers and consumers link without touching the user's session, and runs libpipewire consumers against it as the reference a producer is checked by.
Package pwtest starts a private PipeWire daemon for tests, so producers and consumers link without touching the user's session, and runs libpipewire consumers against it as the reference a producer is checked by.
Package portaldialogs is the dev.stubbe.lys.PortalDialogs1 contract: the native dialogs lys-shell shows behind the desktop-portal backend's Access, Account, AppChooser, DynamicLauncher, Usb and Wallpaper preview, in place of xdg-desktop-portal-gtk, and the password prompt and administrator authentication other lys processes ask through it.
Package portaldialogs is the dev.stubbe.lys.PortalDialogs1 contract: the native dialogs lys-shell shows behind the desktop-portal backend's Access, Account, AppChooser, DynamicLauncher, Usb and Wallpaper preview, in place of xdg-desktop-portal-gtk, and the password prompt and administrator authentication other lys processes ask through it.
The CSS box primitives: per-corner rounded fills, rounded border rings with per-side widths and colors, angled multi-stop linear gradients, and box shadows with offset, spread, blur, and inset — everything a CSS box paints behind its content.
The CSS box primitives: per-corner rounded fills, rounded border rings with per-side widths and colors, angled multi-stop linear gradients, and box shadows with offset, spread, blur, and inset — everything a CSS box paints behind its content.
Package sockdir gives tests a directory short enough to hold Unix sockets.
Package sockdir gives tests a directory short enough to hold Unix sockets.
Bidirectional resolution (UAX #9) for every text path in the family (stubbedev/lys-ui#68): mixed Hebrew/Arabic + Latin lines resolve into directional runs that the shaper lays out visually correct, and the editable widgets of lys-ui map caret motion through.
Bidirectional resolution (UAX #9) for every text path in the family (stubbedev/lys-ui#68): mixed Hebrew/Arabic + Latin lines resolve into directional runs that the shaper lays out visually correct, and the editable widgets of lys-ui map caret motion through.
third_party
godbus
Package dbus implements bindings to the D-Bus message bus system.
Package dbus implements bindings to the D-Bus message bus system.
godbus/introspect
Package introspect provides some utilities for dealing with the DBus introspection format.
Package introspect provides some utilities for dealing with the DBus introspection format.
godbus/prop
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
gomath
Package gomath is Go's math package for the functions whose results depend on the architecture: the portable implementations alone, each product explicitly rounded, so one input gives one result everywhere.
Package gomath is Go's math package for the functions whose results depend on the architecture: the portable implementations alone, each product explicitly rounded, so one input gives one result everywhere.
rasterx
Package rasterx implements a rasterizer in go.
Package rasterx implements a rasterizer in go.
typesetting/bidi
bidi implements the Unicode Bidi algorithm.
bidi implements the Unicode Bidi algorithm.
typesetting/font
Package font provides an high level API to access Opentype font properties.
Package font provides an high level API to access Opentype font properties.
typesetting/font/cff/interpreter
Package psinterpreter implement a Postscript interpreter required to parse .CFF files, and Type1 and Type2 Charstrings.
Package psinterpreter implement a Postscript interpreter required to parse .CFF files, and Type1 and Type2 Charstrings.
typesetting/font/opentype
Package opentype provides the low level routines required to read and write Opentype font files, including collections.
Package opentype provides the low level routines required to read and write Opentype font files, including collections.
typesetting/harfbuzz
Package harfbuzz provides advanced text layout for various scripts and languages, with font-aware substitutions and positionning.
Package harfbuzz provides advanced text layout for various scripts and languages, with font-aware substitutions and positionning.
typesetting/internal/unicodedata
Package unicodedata provides additional lookup functions for unicode properties, not covered by the standard package unicode.
Package unicodedata provides additional lookup functions for unicode properties, not covered by the standard package unicode.
typesetting/segmenter
Package segmenter implements Unicode rules used to segment a paragraph of text according to several criteria.
Package segmenter implements Unicode rules used to segment a paragraph of text according to several criteria.
vector
Package vector provides a rasterizer for 2-D vector graphics.
Package vector provides a rasterizer for 2-D vector graphics.
vk
Package vk provides Pure Go Vulkan bindings, calling through internal/ffi.
Package vk provides Pure Go Vulkan bindings, calling through internal/ffi.
vk/internal/ffi
Package ffi is the slice of goffi's API the Vulkan bindings call through, carried out by github.com/ebitengine/purego: purego and goffi each link a runtime shim (fakecgo) and cannot share a program, and purego is the one lys-ui's applications already use to load native libraries.
Package ffi is the slice of goffi's API the Vulkan bindings call through, carried out by github.com/ebitengine/purego: purego and goffi each link a runtime shim (fakecgo) and cannot share a program, and purego is the one lys-ui's applications already use to load native libraries.
wayland/external/swizzle
Package swizzle provides functions for converting between RGBA pixel formats.
Package swizzle provides functions for converting between RGBA pixel formats.
wayland/os
Package os implements an operating system routines useful for graphics
Package os implements an operating system routines useful for graphics
wayland/unstable/text-input-v3
Package text implements the text_input_unstable_v3 protocol
Package text implements the text_input_unstable_v3 protocol
wayland/unstable/xdg-decoration-v1
Package xdg implements the xdg_decoration_unstable_v1 protocol
Package xdg implements the xdg_decoration_unstable_v1 protocol
wayland/wl
Package wl implements the stable Wayland protocol
Package wl implements the stable Wayland protocol
wayland/wlclient
Package wlclient implements a wayland-client like api
Package wlclient implements a wayland-client like api
wayland/wlcursor
Package wlcursor implements a Wayland cursor
Package wlcursor implements a Wayland cursor
wayland/wlcursor/xcursor
Package xcursor loads and parses the X cursor
Package xcursor loads and parses the X cursor
wayland/xdg
Package xdg implements the stable XDG Window Manager Base protocol
Package xdg implements the stable XDG Window Manager Base protocol
Package udmabuf allocates linear, CPU-visible dmabufs through /dev/udmabuf: a sealed memfd wrapped as a dmabuf, so tests and demos can hand the compositor dmabufs they fill and read without a GPU library.
Package udmabuf allocates linear, CPU-visible dmabufs through /dev/udmabuf: a sealed memfd wrapped as a dmabuf, so tests and demos can hand the compositor dmabufs they fill and read without a GPU library.
Package v4l2 streams a V4L2 capture node in pure Go (mmap buffers over golang.org/x/sys/unix ioctls), delivering each frame as an RGBA picture letterboxed to a requested aspect, and names the capture nodes a system has.
Package v4l2 streams a V4L2 capture node in pure Go (mmap buffers over golang.org/x/sys/unix ioctls), delivering each frame as an RGBA picture letterboxed to a requested aspect, and names the capture nodes a system has.
Package vinput injects pointer and keyboard input into the compositor through zwlr_virtual_pointer_v1 and zwp_virtual_keyboard_v1, on a private Wayland connection: the input half of a remote-desktop bridge, and of lys-ui's own headless test harness.
Package vinput injects pointer and keyboard input into the compositor through zwlr_virtual_pointer_v1 and zwp_virtual_keyboard_v1, on a private Wayland connection: the input half of a remote-desktop bridge, and of lys-ui's own headless test harness.
Package wlr implements the alpha_modifier_v1 protocol
Package wlr implements the alpha_modifier_v1 protocol
Package wltest helps tests run Wayland clients: a private runtime dir and a loopback display for wire-level tests with no compositor, and, against the headless compositor the test recipes boot, a client that puts solid-colored surfaces on screen for capture tests to find.
Package wltest helps tests run Wayland clients: a private runtime dir and a loopback display for wire-level tests with no compositor, and, against the headless compositor the test recipes boot, a client that puts solid-colored surfaces on screen for capture tests to find.
Package xdg resolves the XDG base directories and user directories: the base directories themselves, and an app's own directory under each, all read from an Env.
Package xdg resolves the XDG base directories and user directories: the base directories themselves, and an app's own directory under each, all read from an Env.
xkb
Package xkb is a pure-Go implementation of the XKB keyboard model: compiling keymaps from rules, model, layout, variant and options, parsing and serializing keymap text in the xkb_v1 and libxkbcommon v2 formats, tracking modifier, layout and LED state, composing keysym sequences into text, and reading keymaps from an X server.
Package xkb is a pure-Go implementation of the XKB keyboard model: compiling keymaps from rules, model, layout, variant and options, parsing and serializing keymap text in the xkb_v1 and libxkbcommon v2 formats, tracking modifier, layout and LED state, composing keysym sequences into text, and reading keymaps from an X server.
internal/genkeysyms command
Command genkeysyms writes the xkb package's keysym tables: the names come from libxkbcommon's xkbcommon-keysyms.h, and the canonical names, the Unicode conversions and the case mappings from asking libxkbcommon itself, so the tables are the library's own answers.
Command genkeysyms writes the xkb package's keysym tables: the names come from libxkbcommon's xkbcommon-keysyms.h, and the canonical names, the Unicode conversions and the case mappings from asking libxkbcommon itself, so the tables are the library's own answers.
registry
Package registry lists the models, layouts, variants and options a ruleset offers, from xkeyboard-config's XML files, the way libxkbregistry does.
Package registry lists the models, layouts, variants and options a ruleset offers, from xkeyboard-config's XML files, the way libxkbregistry does.
x11
Package x11 is a minimal X11 client for xkb.SetupX11: a connection to an X server over its Unix socket, authenticated from the Xauthority file, that carries requests with one reply each.
Package x11 is a minimal X11 client for xkb.SetupX11: a connection to an X server over its Unix socket, authenticated from the Xauthority file, that carries requests with one reply each.

Jump to

Keyboard shortcuts

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