NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #1113 most downloaded on crates.io
Rust bindings to X11
Last release 2 months ago
16 Jul 2026
Ships fairly regularly
a new release about every 5 months
Nearly every release is documented
notes for 20 of 20 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
20 releases · first in 2019
Allow building with libloading 0.9.
New features:
Fixes:
CUT_BUFFER0 to CUT_BUFFER7 atom names. The generated code previously
used CUT_BUFFE_R0.Breaking changes:
Minor changes:
Update cursor icon file search path to follow a change in libxcb-cursor which in turn was changed to follow libXcursor.
New features:
$XCURSOR_THEME if set.XCBConnection::from_existing_connection to allow wrapping anything
that implements AsRawXcbConection. Without this function, unsafe code was
required from the user.raw-window-handle feature which makes XCBConnection implement
HasRawDisplayHandle and WindowWrapper implement HasRawWindowHandle.hints.mostly-unused Cargo feature. This might improve compilation
speed with nightly compilers.Fixes:
cargo test --no-default-features works. This is now also tested in CI.present feature depends on dri3 to actually work, but this was not
specified in Cargo.toml.Breaking changes:
Minor changes:
One column per quarter.
Add an xkbcommon-example to showcase use of x11rb together with the xkbcommon crate.
New features:
xkbcommon-example to showcase use of x11rb together with the
xkbcommon crate.Fixes:
atom_manager! macro now uses::std when referring to std
items.Breaking changes:
atom_manager! implementation. This changes the contents of the
generated Cookie struct, but there should be no reasons to access these
directly.StreamAdaptor.Minor changes:
A bitmask enum in the generates code has new methods bits() for conversion to integer and remove() for removing certain bits.
New features:
bits() for conversion
to integer and remove() for removing certain bits.$DISPLAY parsing to match new behaviour in libxcb 1.16.x11rb_protocol::parse_display is now also available in
no_std mode.$DISPLAY parsing fails.Image::into_owned() to get an Image instance with 'static.Image::put() to convert the image to the X11 server's native
representation before uploading.RequestConnection for &C, &mut C, Box<C>, Arc<C>,
Rc<C> and Cow<'_, C> where C: RequestConnection.Fixes:
dl-libxcb feature on OpenBSD. There is no libxcb.so.2 on this
system and we can simply ask for libxcb.so to be loaded.Breaking changes:
WmClass, WmSizeHints, and
WmHints helpers by introducing an Option in their return value.
Previously, missing properties were reported as a parsing error.Vec in some places in x11rb-protocol by using arrays instead. This
affects the return value of a request's serialize() function, but also some
internal code.read_exact() method in x11rb's Stream trait.PartialEq due to rustix's behaviour. FD
passing now uses std::os::unix::io::OwnedFd.x11rb::rust_connection::stream::DefaultStream to
also return the address that a connection was established to.WindowWrapper not to require a reference to a
connection, but to accept any connection type directly. Due to the new feature
mentioned above, this allows to use these wrappers e.g. with Arc<C>.PartialEq, Eq, PartialOrd, Ord, and Hash only if the new
extra-traits feature is enabled. The Debug impl only produces the name of
the type and not its contents in this case. This change improves compile times
of the crate.R::try_parse_request function is now gated
behind the new request-parsing feature. This change improves compile times.Minor changes:
unix by using rustix instead.There is a new crate x11rb-async that brings x11rb to the async ecosystem.
New features:
as-raw-xcb-connection crate.x11rb_protocol::connection::Connection.tracing crate.Fixes:
Image::get() for big-endian servers.XCBConnection on architectures without AtomicU64.Breaking changes:
x11rb_protocol::protocol::xinput::EventForSend now return
ParseError instead of unwrapping errors internally.x11rb_protocol::protocol::xkb are
now better. For example, SelectEventsAuxBitcase1 is now called
SelectEventsAuxNewKeyboardNotify, which at least hints towards its meaning.Image::get() now also returns the visual ID from the GetImageReply.Minor changes:
unwrap()s in generated code by moving this to a
hand-written helper function.unwrap()s in examples.Fix connection breakage after sending 2^16 requests without a reply.
Fixes:
All extensions are available in no-std mode.
New features:
Serialize.x11rb::image::Image now implements Clone.Fixes:
Breaking changes:
xproto::ConfigWindow fit into u8, so previously this was the type used for
representing this enumeration. However, it is used as a mask for the
value_mask field of ConfigureRequestEvent, which has 16 bits. Thus,
ConfigWindow is now represented as u16 and the value_mask field of
ConfigureRequestEvent now has type ConfigWindow.once_cell switched to the 2021 edition.Minor changes:
discard_reply() implementation in Rust for cases with many pending
replies via a binary search.Fix compilation on non-Linux unixes.
Fixes:
x11rb was split into two crates: x11rb-protocol contains code for working with the X11 protocol, but does not do any X11 I/O. The x11rb crate uses x11
New features:
Default,
PartialOrd, Ord, and Hash.x11rb-protocol can be used in no_std mode.serde::Serialize and
serde::Deserialize.Breaking changes:
CreateWindowRequest::send() was previously an associated function
and was removed, because a similar feature is available via the new request
traits. Also, the API for constructing a resource manager database was changed
to remove the need for network I/O from its constructor. A convenience
function for the old default behaviour is provided in x11rb.Minor changes:
#[must_use] to setter methods on *Aux structs.CLOEXEC flag applied.Add protocol::ClientMessageEvent::new().
New features:
protocol::xproto::ClientMessageEvent::new().x11_utils::X11Error.protocol::xproto::PixmapWrapper calls free_pixmap() in its Drop
implementation.wrapper::GrabServer that calls ungrab_server() in its Drop
implementation.Breaking changes:
clippy::upper_case_acronyms warnings:
errors::ConnectError:
IOError becomes IoErrorZeroIDMask becomes ZeroIdMaskFDPassingFailed becomes FdPassingFailedimage::ImageOrder:
LSBFirst becomes LsbFirstMSBFirst becomes MsbFirstMinor changes:
x11rb::connect() now always returns a RustConnection. Previously, it
returned impl Connection and used XCBConnection if that was enabled.Update to latest version of crate dependencies.
Minor changes:
Added a resource_manager library for querying the X11 resource database (Xrm).
New features:
resource_manager library for querying the X11 resource database
(Xrm).from_configure_request(&ConfigureRequestEvent) function to
xproto::ConfigureWindowAux.Fixes:
<enum> representation so that we can represent invalid values from
the X11 server. This mainly fixes problems with XInput.InvalidValue variant to the representation of <switch>es. This
variant is used when the server sends an invalid value for the <switch>
discriminant. This fixes problems with XInput.cursor code now depends on the Xrm code for proper database support.Breaking changes:
<enum> representation: Instead of using a Rust enum, we now use a
newtype around an integer. The named variants are provided as associated
constants instead of enum variants. Due to Rust's naming rules, this means
that e.g. xproto::EventMask::ButtonRelease is now called BUTTON_RELEASE.ParseError no longer implements From<Infallible>.bool.TryFrom<uXX> implementations for enumerations.TryFrom<&[u8]> implementations from the generated code.Minor changes:
unwrap()s in the generated code.ConfigWindow::WIDTH | 0 now has type
ConfigWindow instead of u8).Debug impl to enums that selects between UPPER_CASE and CamelCase
based on the alternate() flag.TryIntoUSize to shorten the conversion from
other numbers to usize.#![allow]s from the generated code.An image utility was added under x11rb::image. This allows to do similar things as xcb's image library, e.g. endian conversion. A new display_ppm exam
New features:
x11rb::image. This allows to do similar
things as xcb's image library, e.g. endian conversion. A new display_ppm
example showcases this new library a bit.dl-libxcb feature. With this feature, we do not link against
libxcb.so for XCBConnection, but instead load the library at runtime via
libloading.send() method. This allows for more readable
request sending, without having to wonder "what was the fifth argument to
create_window again?":conn.create_window(
screen.root_depth,
win_id,
screen.root,
0,
0,
width,
height,
0,
WindowClass::InputOutput,
0,
&win_aux,
)?;
CreateWindowRequest {
depth: screen.root_depth,
wid: win_id,
parent: screen.root,
x: 0,
y: 0,
width,
height,
border_width: 0,
class: WindowClass::InputOutput,
visual: 0,
value_list: std::borrow::Cow::Borrowed(&win_aux),
}.send(conn)?;
Fixes:
x11rb::x11_utils::X11Error, because all errors are structurally equivalent.
Only the error code differs.docs.rs, hopefully making the docs complete.Breaking changes:
#[non_exhaustive].x11rb::errors::ParseError was split up into multiple values
that now provide more information about which kind of error occurred.x11rb::cursor behind a feature gate.x11rb::protocol::Error and all individual error structs were removed and
replaced with x11rb::x11_utils::X11Error. This removes about 2.5k LOC of
generated code.#[non_exhaustive]. This includes all enums in
the generated protocol code.Minor changes:
x11rb::utils::RawFdContainer now always implements Drop, even on
non-cfg(unix) systems.xtrace-example that runs a program and prints all of its X11
traffic to the console.simple_window_manager example was improved. It now has better support
for titlebars: Only clicks inside the close button close the window and the
remaining area allows to move a window. Also, the example now uses the X11
save set.nix 0.18 and winapi-wsapoll 0.1.1.The examples in this repository where extended:
New features:
xclock_utc example shows a clock. This is useful to see how to get a
wakeup once per second.cairo-example uses a transparent background if a EWMH compliant composite
manager is running.xproto::GetModiferMappingReply's keycodes_per_modifier field.structs for X11 requests and added infrastructure for parsing
requests. Interested users should start with the protocol::Request enum.protocol::Reply enum over all possible replies.TryParseFd trait for types that can be parsed from a combination of
raw bytes and a list of file descriptors.Fixes:
poll() are now required.RustConnection::poll_for_event() previously only checked for pending queued
event, but did not actually try to read new events from the X11 server.remaining slice.Breaking changes:
rust_connection's low level stream abstraction was
redesigned. This now uses an abstraction over the poll() function from libc
(and requires similar support for all alternative transport implementations).allow-unsafe-code feature is no longer enabled by default.xkb_select_event's affect_which field is now deduced based on other
arguments and no longer has to be provided explicitly.VoidCookie::check() from Result<Option<Error>, ConnectionError> to Result<(), ReplyError>. This still has the same
possible errors as before, but they are represented differently.response_type fields from errors and replies, because they always
have a fixed value (0 for errors and 1 for replies).Minor changes:
x11rb::rust_connection::Stream now implements the traits AsRawFd,
IntoRawFd, AsRawSocket, and IntoRawSocket.x11rb::rust_connection::RustConnection provides immutable access to its low
level stream via the stream() method.The new Connection::prefetch_maximum_request_bytes() API allows avoiding a round-trip when sending large requests.
New features:
Connection::prefetch_maximum_request_bytes() API allows avoiding a
round-trip when sending large requests.u8 were used. This simplifies usage of much of the API.x11rb::extension_manager::ExtensionInformation can now provide information
about all the extensions that are known to be present.x11rb::protocol::Error and Event allow representing any possible
error or event in a parsed form. This allows e.g. matching on events for
event handling. Also, these enums implement Debug and thus allow printing
human-readable output on unexpected errors or events. This type also abstracts
some of the complications of parsing events away from the library user. The
Connection trait was extended to be able to parse events/errors into these
new types.xproto::change_property now accepts Into<ATOM> instead of just
ATOM as the name of the property to be changed. Thus, the predefined atoms
like AtomEnum::WM_NAME can be used directly without having to call .into()
yourself.xproto::WINDOW is now
called xproto::Window.WM_CLASS, WM_SIZE_HINTS, and WM_SIZE
properties.Serialize and TryParse for tuples.simple_window example was extended to use the new API.RustConnection now supports FD passing.Fixes:
QueryExtension request failed was fixed.XCBConnection.Pixmap type, but also wants to refer to xproto's Pixmap in some places.<switch> cases with only one
visible field. This affected only the xinput and xkb extensions.XCBConnection after 2^32 requests.
The old code only ever provided 32 bits of the sequence number.atom_manager! invocations.Breaking changes:
vendor-xcb-proto feature flag is no longer available. The included
xcb-proto is now always used.xproto feature flag was removed. It did not do anything.x11rb::generated was renamed to x11rb::protocol.XIQueryVersion becomes
xi_query_version instead of xiquery_version.u16.x11rb::connection::Connection::compute_length_field() was moved out of the
Connection trait and to x11rb::connection::compute_length_field().Enum attached to their
name. For example, xproto::Atom is now called xproto::AtomEnum.RequestConnection::extension_information
instead of the full QueryExtensionReply.ExtensionInformation struct to ExtensionManager.GenericEvent, GenericError, and the related Event trait were removed.RequestConnection and Connection that affect implementations of
these traits. For example, methods parse_event and parse_error were added.Connection trait now returns parsed event and errors of type
x11rb::protocol::Event and Error, respectively. The old API providing
bytes is retained with alternative names. For example, there is
wait_for_event() and wait_for_raw_event().Connection trait now return X11 errors in their Ok
variant via a new ReplyOrError enum. This should only affect implementations
of the Connection trait.xinput. This is related to
<switch> handling.EventAndSeqNumber.Serialize implementations were removed from types that depend on value
from the surrounding context.RustConnection now supports FD passing. This removes the API for
constructing a RustConnection from a pair of Read and Write, but
alternatives for the new API exists.RawFdContainer provides no methods when it is not available. This turns some
run-time errors into compile-time errors.Minor changes:
--stat
output).xcb-proto are excluded from releases, shrinking the
size of the crate a bit.XCBConnection now uses xcb_poll_for_reply64() instead of
xcb_poll_for_reply(). This means that libxcb 1.12 or newer is required.simple_window example sets more properties.bool for enums with just two values.u8.RustConnection.From<ParseError> for ReplyOrIdError.RawFdContainer no longer depends on the allow-unsafe-code feature.RawFdContainer no longer panics when the close on drop fails.close() and try_clone() is available on RawFdContainer.<eventcopy> and <errorcopy> definitions. This means
that the Debug implementation may now print the 'wrong' type name, but
shortens the generated code by more than 4000 lines.Fix encoding of xkb::SelectEvents. More details can be found in commit 83ff34452bf9.
Fixes for XKB:
xkb::SelectEvents. More details can be found in commit
83ff34452bf9.switch structs public so that e.g. GetMapMap becomes
usable.Minor changes:
allow-unsafe-code feature is enabled.rust_connection/xcb_ffi modules.multithread_test from examples/ to tests/.Add support for the XKB and XInput extensions to the code generator.
New features:
GetKbdByName, GetGeometry, SetGeometry, ListComponents are not
correctly described by xcb-proto and thus still unsupported.allow-unsafe-code and forbid(unsafe-code) without this feature.x11rb::connect() for establishing a connection to an X11 server.
Depending on the allow-unsafe-code feature, this either returns a
RustConnection or an XCBConnection.RustConnection fully functional and thread-safe.
gethostname crate.atom_manager! macro.
Serialize trait for producing wire bytes from an in-memory
representation.
Vec<u8> or by appending into a
provided &mut Vec<u8>.GetPropertyReply that simplify its interpretation.
value8(&self), value16(&self) and value32(&self) methods
that check for the correct format and return an iterator over the value.XCBConnection from a raw pointer.Connection::wait_for_event_with_sequence() and
Connection::poll_for_event_with_sequence() that allow to get an event
together with its full sequence number.cargo:rerun-if-changed= lines from build.rs.x11rb::utils::CSlice safer.rustfmt.Breaking changes:
all-extensions feature
enables all X11 extensions.Results in some places that previously ignored errors or paniced.ConnectionError into two enums, one for errors that can occur while
establishing a connection and another for errors on an already-established
connection.ConnectionExt traits with the extension
name. This is necessary since several extensions contain different versions of
the same request.
x11rb::generated::shm::ConnectionExt::create_pixmap is
now called shm_create_pixmap to avoid a collision with
x11rb::generated::xproto::ConnectionExt::create_pixmap. The plain function
shm::create_pixmap kept its name.ConnectionErrorOrX11Error to ReplyError.x11rb::utils::Buffer type. Instead, there is an associated type
Connection::Buf. This is Vec<u8> for RustConnection and CSlice for
XCBConnection.LazyAtom.Changes to the generated code and the code generator.
From instead of Into in the generated code.WINDOW instead of u32.Vec to fixed
length arrays.SetModifierMapping request. The code generator was ignoring an
expression that required a multiplication with a constant value to get the
length of a list.SetupAuthenticate and res's ClientIdValue serialization. An
expression in the XMl was ignored.TryFrom<uX> for enums.Many thanks to @dalcde and @eduardosm for their valuable contributions.
Split out some types from x11rb::connection into their own modules.
x11rb::connection into their own modules.xcb_ffi and rust_connection into multiple modules.WINDOW in the generated code instead of u32.i64 was
used instead of the correct Int64.bool types can be properly
handled in the generated code.LazyAtom type that sends an InternAtom request and asynchronously
waits for the answer.Clone, PartialEq, and Eq for various types.xcb.h.Connection implementations to be unsized (?Sized).Connection trait into RequestConnection and Connection.extension_information().From.query_version being defined by basically all extensions.XCBConnection.TryFrom<&Buffer>,
From<&GenericEvent>, and From<&GenericError>.From<GenericError> for GenericEvent.XCBConnection and RustConnection.<pad align="4"/>.sequence_number() and raw_reply() functions to all cookies.Makefile that allows to evaluate changes to the code generator. Usage
is make ref, then changing the code generator, then make cmp to get a diff
with the changes.TryParse only for structs.xcb_aux_sync() / XSync().The only_if_exists parameter of InternAtom has type bool.
only_if_exists parameter of InternAtom has type bool.SendEvent usable. Events now implement Into<[u8; 32]>.sequence to the generates structs for replies, errors, and
events.From<GenericEvent> for events and From<GenericError> for errors.Eq for the error enums.Result from send_request_with/without_reply().XCBConnection Send and Sync.xcb_connection_t* to XCBConnection.AsRawFd for XCBConnection.<doc> tags in the XML.vendor-xcb-proto feature is enabled, which it is by default. Thus, this
crate becomes easier to compile.xcb_send_request64() so that the indices -1 and -2 are
valid.poll_for_event() to Connection.xeyes, hypnomoire, tutorialChangeProperty.ChangeProperty,
ChangeKeyboardMapping, GetPropertyReply, ...)examples/tutorial.rs.* First release.
Your coding agent can read these notes before it upgrades. Set up the MCP server →