Xephyr is a nested X server that runs as an X application.
This may be useful to workaround a badly written application. For example, Supermicro servers may be controlled with java ipmi kvm viewer application. While server is rebooting, the application frequently recreates its window. It steals focus from your current window. This happens several times per minute, and actually makes your work impossible. At the same time, it is not obvious how to make a window rule that prevent such application's window to get focused when created, because you want it to get focus when you launch it first time. Using xephyr allows you to keep these window recreations to happen inside a separate window, which do not steals focus of your currently opened window.
If you wish to run a nested X window, you'll need to specify a new display.
$ Xephyr -br -ac -noreset -screen 800x600 :1
This will launch a new Xephyr window with a DISPLAY of ":1". In order to launch an application in that window, you would need to specify that display.
$ DISPLAY=:1 xterm
Launching Window Managers
If you want to launch a specific WM, spectrwm for example, you would type:
$ DISPLAY=:1 spectrwm
You can also launch Xephyr with your xinitrc using startx:
$ startx -- /usr/bin/Xephyr :1
Grabbing and Ungrabbing User Input
Ctrl + Shift should lock/unlock your mouse pointer and your keystrokes inside Xephyr window exclusively if possible.