Experimenting with window managers
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 "$@"
Some explanation:
DPY
variable 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 sessionRES
variable is the resolution for the Xephyr session, i.e., a window with that resolution will be created-ac
argument is for disabling access control restrictions, which isn’t really necessary when experimenting. It saves us a lot of hassle-kb
argument is for disabling the X keyboard extension. This allows you to use any key binding within your Xephyr session- The
"$@"
will allow you to add additional arguments to Xephyr through the wrapper script. SeeXephyr -help
for more options
Save the script to a directory which is in your PATH
(e.g., /usr/local/bin
or ~/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):
$ xephyr
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! :)
June 2nd, 2013 at 11:31
Thank you for this post.
I’m just about to experiment with WMs.
September 13th, 2017 at 00:35
http://maximilian5576.Soup.Io
Experimenting with window managers