A portable X11 server implementation in Rust with modular backend support.
X11Anywhere is an X11 display server that can run on Linux, macOS, and Windows. It accepts X11 protocol connections from clients and translates them to native display systems through a pluggable backend architecture.
- Portable: Runs on Linux, macOS, and Windows
- Modular Backends: Choose your display system (X11, Wayland, macOS native, Windows native)
- Security-Focused: Built-in isolation and security features to protect the host
- Minimal Dependencies: Lightweight with minimal external dependencies
- Protocol Compliant: Implements the X11 core protocol
Visual test output showing X11 drawing operations on all supported platforms:
| Linux | macOS | Windows |
|---|---|---|
![]() |
![]() |
![]() |
Screenshots are automatically updated by CI after each push to master.
X11 Clients (TCP/Unix Socket)
↓
Connection Layer
↓
Protocol Parser/Encoder
↓
Core Server (Window Tree, Resources, Events)
↓
Security/Isolation Layer
↓
Backend Abstraction
↓
┌──────┬─────────┬────────┬─────────┐
X11 Wayland macOS Windows
See ARCHITECTURE.md for detailed design documentation.
By default, the appropriate backends for your platform are automatically enabled:
# Build with platform defaults (recommended)
cargo build
# On Linux/BSD: builds with X11 + Wayland backends
# On macOS: builds with macOS native backend
# On Windows: builds with Windows native backendThe build system automatically enables the right backends:
- Linux/BSD: X11 + Wayland backends (both useful on modern Linux)
- macOS: macOS native backend (Cocoa/Quartz)
- Windows: Windows native backend (Win32)
Build with specific backends only:
# X11 only (minimal Unix build)
cargo build --no-default-features --features backend-x11
# Wayland only
cargo build --no-default-features --features backend-wayland
# Minimal builds with convenience features
cargo build --no-default-features --features minimal-x11
cargo build --no-default-features --features minimal-waylandYou can explicitly enable backends for testing:
# Enable X11 on macOS (requires XQuartz installed)
cargo build --features backend-x11
# Test multiple backends during development
cargo build --features backend-x11,backend-wayland# Auto-detect backend
x11anywhere -display 1
# Specify backend explicitly
x11anywhere -display 1 -backend x11
# Enable TCP listening
x11anywhere -display 1 -backend wayland -tcp# Permissive (for testing)
x11anywhere -display 1 -security permissive
# Default (recommended)
x11anywhere -display 1 -security default
# Strict (maximum security)
x11anywhere -display 1 -security strict-display <n>- Display number (default: 1)-backend <type>- Backend type (x11, wayland, macos, windows)-tcp- Listen on TCP socket (port 6000 + display)-unix- Listen on Unix socket (default on Unix)-security <level>- Security level (permissive, default, strict)-list-backends- List available backends-h, --help- Show help
X11Anywhere includes several security features:
- Window Isolation: Clients can only see their own windows by default
- Property Protection: Restrict property access between clients
- Selection Control: Mediate clipboard/selection access
- Grab Restrictions: Limit keyboard/pointer grabs
- Resource Limits: Prevent resource exhaustion
Configure these with the -security flag or via config file.
Run Linux X11 applications natively on macOS or Windows without a full X11 server like XQuartz:
# On macOS
x11anywhere -display 1 -backend macos
# On Windows
x11anywhere -display 1 -backend windows
# Then set DISPLAY and run your app
export DISPLAY=:1
xtermRun a nested X server on Linux for testing:
x11anywhere -display 2 -backend x11
DISPLAY=:2 xclockRun X11 apps on Wayland with better integration:
x11anywhere -display 1 -backend waylandRun untrusted X11 applications in isolation:
x11anywhere -display 99 -security strict
DISPLAY=:99 untrusted-appThis project has completed its core implementation across all major platforms:
Core Protocol
- ✅ Connection setup and authentication
- ✅ Window operations (Create, Map, Unmap, Destroy, Configure, Raise, Lower)
- ✅ Graphics contexts (Create, Change, Free)
- ✅ All drawing operations (rectangles, lines, points, arcs, polygons, text)
- ✅ Image operations (PutImage, GetImage)
- ✅ Pixmap support (off-screen drawables)
- ✅ Event handling (Expose, Configure, Key, Button, Motion, Focus, Enter/Leave)
Resources
- ✅ Properties and atoms (InternAtom, GetAtomName, ChangeProperty, GetProperty)
- ✅ Selections/clipboard (SetSelectionOwner, GetSelectionOwner, ConvertSelection)
- ✅ Fonts (OpenFont, CloseFont, QueryFont, ListFonts)
- ✅ Colors (AllocColor, AllocNamedColor with 70+ named colors)
- ✅ Cursors (standard system cursors)
Backends
- ✅ X11 Backend (Linux/BSD) - Full passthrough to native X11
- ✅ Windows Backend - Complete Win32/GDI implementation
- ✅ macOS Backend - Full Cocoa/Core Graphics via Swift FFI
Phase 1: Core Window Management ✅ COMPLETED
Phase 2: Basic Drawing ✅ COMPLETED
Phase 3: Advanced Features ✅ COMPLETED
- Enhanced event handling, arc/polygon drawing, image operations
- Cursor support, window properties, selections, fonts, colors
Phase 4: Optimization & Testing (Current)
- Performance profiling
- Comprehensive testing with various X11 applications
- Bug fixes and edge cases
- Documentation improvements
Phase 5: Wayland Support
- Research and design Wayland backend
- Implement basic Wayland support
Future: X11 Extensions
- RENDER (alpha blending)
- XFIXES
- DAMAGE
- COMPOSITE
Contributions are welcome! Areas where help is needed:
- Testing with real X11 applications (xclock, xterm, xeyes, etc.)
- Wayland backend implementation
- X11 extension support (RENDER, XFIXES, etc.)
- Documentation and examples
- Performance optimization
- Bug reports and fixes
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
This project is inspired by:
- XQuartz - X11 for macOS
- Xwayland - X11 compatibility for Wayland
- Xephyr - Nested X server
- TigerVNC - VNC server with X11 support


