LinuxCommandLibrary

xephyr

Run nested X server in a window

TLDR

Create a black window with display ID ":2"

$ Xephyr -br -ac -noreset -screen [800x600] [:2]
copy

Start an X application on the new screen
$ DISPLAY=:2 [command_name]
copy

SYNOPSIS

xephyr [options] [:displaynum]

PARAMETERS

-screen WxH
    Sets the initial screen size (width x height) of the xephyr window. For example, -screen 800x600.

-resizeable
    Allows the xephyr window to be resized by the host window manager, which in turn resizes the X screen within xephyr.

-fullscreen
    Starts xephyr in fullscreen mode, taking over the entire host display.

-host-cursor
    Uses the host X server's cursor for the nested display, rather than drawing its own. This can improve cursor responsiveness.

-no-host-grab
    Prevents xephyr from grabbing input (keyboard and mouse) from the host X server. Useful when you want to switch focus easily without an explicit key combination.

-composite
    Enables the Composite extension in the nested server. This is often required for modern desktop environments and applications that use transparency and visual effects.

-depth N
    Sets the default color depth for the xephyr display, e.g., -depth 24.

-keybd KEYBOARD_DEVICE
    Specifies a specific keyboard input device to use, bypassing default auto-detection.

-mouse MOUSE_DEVICE
    Specifies a specific mouse input device to use, bypassing default auto-detection.

-geometry GEOMETRY
    Sets the initial position and size of the xephyr window on the host display, e.g., -geometry 800x600+100+50.

:displaynum
    Specifies the display number for the nested X server. For example, :1 for display 1.

DESCRIPTION

xephyr is a display server that runs as a client of another display server. It creates a new X display within a window on an existing X session. This provides an isolated environment, ideal for safely testing X applications, window managers, or entire desktop environments without affecting the main desktop session. It is often used by developers to debug X clients or experiment with different configurations. Unlike its predecessor Xnest, xephyr is based on KDrive, offering better performance and more modern X extensions, including Composite, making it a more versatile tool for contemporary X development and testing.

CAVEATS

While xephyr is excellent for testing, it has limitations:
Performance: May not match a native X server, especially for intensive graphical applications or games.
Hardware Access: Direct hardware access is not available; it relies on the host X server for rendering.
Input Grabbing: Behavior can sometimes be tricky; ensure -no-host-grab or the grab-release key (Ctrl+Shift) is understood.
Extension Support: Some specific X extensions or driver features might not be fully supported or behave identically to a native setup.

TYPICAL USAGE SCENARIOS

xephyr is useful for:
Testing Desktop Environments and Window Managers: Safely try out new desktop environments (e.g., GNOME, KDE, Xfce) or window managers (e.g., i3, AwesomeWM) without logging out of your current session.
X Application Development: Debug X applications in an isolated environment, ensuring they behave correctly on a 'clean' X display.
Sandboxing: Run untrusted X clients in a confined display, preventing them from interacting with your main desktop or sensitive data.
Demonstrations: Easily show off an application or environment without needing a separate machine or virtual machine.

INPUT GRABBING

By default, when the mouse cursor enters the xephyr window, xephyr grabs all keyboard and mouse input. To release the grab and return control to the host X server, press Ctrl+Shift (by default). If you use the -no-host-grab option, xephyr will not grab input, and you can switch between the host and nested display simply by moving the mouse cursor.

HISTORY

xephyr emerged as part of the X.Org project, developed as a modern successor and alternative to the older Xnest utility. Its development was significantly influenced by the KDrive architecture, which aimed to provide a more modular, lightweight, and embeddable X server implementation. This foundation allowed xephyr to offer better performance, support for contemporary X extensions (like Composite), and more robust input handling compared to its predecessor, making it a preferred choice for developers and testers in the X ecosystem.

SEE ALSO

Xnest(1), X(7), xinit(1), startx(1), Xorg(1)

Copied to clipboard