x11

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 14 Imported by: ? 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

Package x11 captures an Xorg (or XWayland) screen with MIT-SHM: each frame is one XShmGetImage of a monitor's rectangle of the root window into shared memory, which the encoder reads in place. RandR lists the monitors and XFixes reads the cursor.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDisplay = errors.New("x11: no X display")

ErrNoDisplay means there is no X server to talk to, or no monitor with the asked ID on it.

Functions

func Available

func Available() error

Available reports whether an X server answers on $DISPLAY.

func DPI

func DPI() int

DPI is the X resource Xft.dpi, which desktops set to their scale times 96; 96 where it is not set.

func Displays

func Displays() ([]capture.Display, error)

Displays lists the X screen's monitors from RandR, or the whole screen as one display where RandR is missing.

func Pointer

func Pointer() (x, y int, err error)

Pointer is where the pointer is on the X screen.

func XWayland

func XWayland() bool

XWayland reports whether the X server is XWayland. A rootless one, as a Wayland desktop runs for its X clients, composes no root image: capture there goes through the desktop portal.

Types

type CursorImage

type CursorImage struct {
	X, Y, W, H, HotX, HotY int
	// Serial changes as the cursor changes shape.
	Serial uint64
	// ARGB holds W*H pixels, premultiplied as XFixes gives them.
	ARGB []uint32
}

CursorImage is the cursor's image from XFixes.

func Cursor

func Cursor(withPixels bool) (CursorImage, error)

Cursor reads the cursor's image, with pixels when withPixels is set.

type Source

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

Source captures one monitor of the X screen at a fixed rate.

func Open

func Open(id string, fps int) (*Source, error)

Open captures the monitor with this ID (a RandR monitor name such as "DP-1"; empty for the primary one) fps times a second.

func (*Source) Close

func (s *Source) Close() error

func (*Source) Display

func (s *Source) Display() capture.Display

Display is the monitor the source captures.

func (*Source) Next

func (s *Source) Next(timeout time.Duration) (capture.Frame, error)

Next waits for the next capture tick and reads the monitor. X11 tells nothing of changes without XDamage, so every tick is a frame.

func (*Source) Release

func (s *Source) Release() error

Jump to

Keyboard shortcuts

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