My current window manager that I’m using, and have used for the last two years, is called wmii (window manager improved 2). Not going into details with wmii, but I experimented and “hacked” around with it quite much in the beginning. The problem was though, while I was doing this I couldn’t keep my regular applications running (browser, mail/chat client, etc.) since I needed to restart the X session regularly.
Then I found out about Xephyr, which basically is an X server which targets a window of another X server as its framebuffer. Making it possible to run a window manager inside of another window manager, for instance.
Xephyr is a great tool to use even if you’re not developing. For instance, it could be used to try out different kinds of window managers. There are quite many out there worth taking a look at.
Anyway, it can be a bit tricky to get Xephyr running if you’re not all that into how X works, so I’ll save you the hassle and tell you how I used it.
I wrote a wrapper script called xephyr (note: small “x”) which simplified the usage, having the options I always want to use.
#!/bin/sh DPY=":1.0" RES="1024x768" Xephyr $DPY -ac -kb -screen $RES "$@"
DPYvariable is the name of the display for the Xephyr session. You will need it later on in order to attach an X application to your Xephyr session
RESvariable is the resolution for the Xephyr session, i.e., a window with that resolution will be created
-acargument is for disabling access control restrictions, which isn’t really necessary when experimenting. It saves us a lot of hassle
-kbargument is for disabling the X keyboard extension. This allows you to use any key binding within your Xephyr session
"$@"will allow you to add additional arguments to Xephyr through the wrapper script. See
Xephyr -helpfor more options
Save the script to a directory which is in your
~/bin), and don’t forget to chmod it (
chmod +x xephyr).
Now, in order to start Xephyr just execute the wrapper script (it will run in the foreground of your terminal, and will output information from the Xephyr session which might be useful if you’re developing):
At this moment you will have a window which contains an empty X session. So, what we need now is to attach a window manager to it. That is done by starting the window manager (in my case wmii) with the environment variable
DISPLAY set to the display the Xephyr session is using (in our case “:1.0″):
$ DISPLAY=":1.0" wmii
If the window with the Xephyr session has focus, it will pass on most keystrokes to that session, but the window manager inside of Xephyr might have key bindings which could collide with your real window manager (if so, they will get overridden by the real one). To exclusively use keyboard and mouse within the Xephyr session, press
CTRL+SHIFT (i.e., press
CTRL first, then also press
SHIFT). That will allow Xephyr to grab all keyboard and mouse events (
CTRL+SHIFT will also release it).
That is all. Happy experimenting! :)