Running a secondary X server

Sometimes it is useful to run a second (or third, or fourth...) X server for testing porpoises. I find this invaluable when hacking at window managers (such as my current favorite, awesome).

It is also occasionally useful to be able to kill an X server with impunity, e.g. to check how an application behaves when its X connection goes away.

Even better: You can use this to deal with less-than-well-behaved programs that require a given resolution or color depth; I use it to be able to play Might and Magic VI full-screen using Wine, without having to fiddle with XRandR to get my resolution back afterwards.

So how do I do this? Simple:
startx /path/to/program option1 option2 -- :1

It really is that simple. If you wish, you can add more options after the double dash to pass them to the invoked X server. For instance, to run MM6 I do this:
startx $HOME/bin/mm6-core -- :1 -depth 16

Where the -depth 16 tells X that I want 16-bit color. mm6-core is simply a script that takes care of invoking Wine with the right options.

No comments: