Using Xephyr
From awesome
| Languages: |
English • Русский |
Here's a brief howto on running nested X servers (X session inside client window of another X session) using Xephyr. This comes handy when testing things without disturbing your normal awesome desktop.
I prefer to run Xephyr and awesome in terminals of their own to see real-time stdout/stderr output.
Contents |
[edit] Get Xephyr
[edit] Archlinux
/usr/bin/Xephyr is provided by xorg-server package.
[edit] Gentoo
/usr/bin/Xephyr is provided by the ebuild x11-base/xorg-server. The USE-Flag kdrive has to be enabled for Xephyr to be built.
[edit] Debian/Ubuntu
/usr/bin/Xephyr is provided by xserver-xephyr package. You can get it using :
# apt-get install xserver-xephyr
[edit] Fedora
/usr/bin/Xephyr is provided in the xorg-x11-server-Xephyr package.
[edit] Run Xephyr
This runs new X server in X client window:
$ Xephyr -ac -br -noreset -screen 800x600 :1
- -ac
- disable access control restrictions
- -br
- create root window with black background
- -noreset
- don't reset after last client exists
- -screen 800x600
- Specify screen characteristics
Once running, you can change value of DISPLAY envirnomental variable to :1.0 and run X apps inside your slave X:
$ DISPLAY=:1.0 $ xterm
New xterm window will appear inside slave X.
[edit] Run awesome in Xephyr
Set the DISPLAY variable:
$ DISPLAY=:1.0
And run awesome in slave X:
$ awesome -c ~/.config/awesome/rc.lua.new
This is good to test modifications of rc.lua. In case of errors, you don't spoil your top-level instance of awesome (resulting in blank root window and no keys bound to do something).
Example: 2009-02-21-004454_1280x800_scrot.png
[edit] More
[edit] Having Xephyr Grab and Release Input
One thing you'll quickly notice is that Awesome will not pass keypresses for keybindings down to the Xephyr session. To make this work, the Xephyr session should grab the keyboard. While the Xephyr window has focus, press Control-mod3-shift to have Xephyr grab focus. You will now see that the mouse can't leave the window. If you want Xephyr to let go, press control-shift. If your modifiers are still not working, then there is some Xephyr wackiness going on. You can use xmodmap and xev to see what the errors are. For me, it was not recognizing the "windows key" as Super_L. I bound it within the Xephyr session using xmodmap:
$ xmodmap - keycode 133 = Super_L # Your keycode might be different. See what it is using xev. # Press Control-D here to finish xmodmap input.
It is also somewhat likely that you are not using the default keymap for your system. You will have to rebind that too.
$ setxkbmap us dvorak
[edit] Remotely restart awesome
Get pid of slave awesome and send it SIGHUP signal:
$ pgrep awesome $ kill -s SIGHUP <pid_of_awesome_in_xephyr>
Or if you'd rather like to use awesome-client:
$ export DISPLAY=:1.0 $ echo 'awesome.restart()' | awesome-client
[edit] Script I use to debug rc.lua
#!/bin/bash # script xepyhr-awesome # author: dante4d <dante4d@gmail.com> Xephyr -ac -br -noreset -screen 800x600 :1 & sleep 1 DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new
[edit] Another script
Download it from http://hellekin.cepheide.org/awesome/awesome_test
awesome_test start|stop|restart|run start Start nested Awesome in Xephyr stop Stop Xephyr restart Reload nested Awesome configuration run Run command in nested Awesome

