x11

package
v0.1.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 25 Imported by: 0 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 is the Linux native window shell: a pure-Go X11 client that speaks the wire protocol directly (no Xlib, no CGO). See ../README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(cfg shell.Config) (shell.Window, error)

Open opens a window on $DISPLAY.

func ParseURIList

func ParseURIList(s string) []string

ParseURIList extracts local file paths from a text/uri-list payload.

Types

type Error

type Error struct {
	Code     uint8
	Seq      uint16
	BadValue uint32
	Minor    uint16
	Major    uint8
}

Error is an X protocol error.

func (*Error) Error

func (e *Error) Error() string

type Window

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

Window is an X11 top-level window implementing shell.Window.

func OpenDisplay

func OpenDisplay(display string, cfg shell.Config) (*Window, error)

OpenDisplay opens a window on the named display ("" = $DISPLAY).

func (*Window) Clipboard

func (w *Window) Clipboard() string

Clipboard returns the current CLIPBOARD text ("" if empty/unavailable).

func (*Window) ClipboardHTML

func (w *Window) ClipboardHTML() string

ClipboardHTML returns the text/html on CLIPBOARD ("" if there is none).

func (*Window) Close

func (w *Window) Close()

Close destroys the window and disconnects.

func (*Window) Events

func (w *Window) Events() <-chan shell.Event

Events implements shell.Window.

func (*Window) LastError

func (w *Window) LastError() *Error

LastError returns the most recent asynchronous protocol error, if any.

func (*Window) OpenURL

func (w *Window) OpenURL(raw string) error

OpenURL opens url with xdg-open. Only URLs with a scheme are accepted so a crafted value can never be interpreted as an option.

func (*Window) Present

func (w *Window) Present(frame *image.RGBA, damage image.Rectangle)

Present implements shell.Window.

func (*Window) SetClipboard

func (w *Window) SetClipboard(s string)

SetClipboard takes ownership of CLIPBOARD and serves s.

func (*Window) SetClipboardRich

func (w *Window) SetClipboardRich(text, html string)

SetClipboardRich serves text and its HTML form (the text/html target) (shell.RichClipboard).

func (*Window) SetCursor

func (w *Window) SetCursor(cur shell.Cursor)

SetCursor implements shell.Window using core-font glyph cursors, which need no theme files and work on every server.

func (*Window) SetFullscreen

func (w *Window) SetFullscreen(on bool)

SetFullscreen asks the window manager (EWMH) to toggle fullscreen; without a window manager it resizes the window to cover the screen itself.

func (*Window) SetIcon

func (w *Window) SetIcon(icon *image.RGBA)

SetIcon sets _NET_WM_ICON from a premultiplied RGBA image (downscaled to at most 256x256 with nearest-neighbour sampling if larger).

func (*Window) SetTitle

func (w *Window) SetTitle(t string)

SetTitle sets WM_NAME and _NET_WM_NAME.

func (*Window) Size

func (w *Window) Size() (int, int, float64)

Size implements shell.Window.

func (*Window) Sync

func (w *Window) Sync() error

Sync waits until the X server has processed everything sent so far.

func (*Window) UsesSHM

func (w *Window) UsesSHM() bool

UsesSHM reports whether Present goes through MIT-SHM.

func (*Window) WindowID

func (w *Window) WindowID() uint32

WindowID returns the X window id (for tests and tools).

Directories

Path Synopsis
cmd
shelldemo command
Command shelldemo animates frames into an X11 shell window and prints the achieved Present throughput and latency at a given size, for full-frame and partial-damage updates.
Command shelldemo animates frames into an X11 shell window and prints the achieved Present throughput and latency at a given size, for full-frame and partial-damage updates.

Jump to

Keyboard shortcuts

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