Main Menu

Projects

Linux Games
Linux Games
[HOWTO Home :: HOWTO INDEX Other :: This page]  

Extra XServer

Author: xeroc (xeroc_ at gmx dot de)
Published: Thu, 09-Feb-2006
Version: 0.2

Creative Commons License
This work is licensed under a Creative Commons License.

Warning: This HOWTO comes with no explicit or implicit warranty whatsoever. Use at your own risk!

Table of Content

1) Preface
2) Why to use an extra X-Server
3) What is $DISPLAY
4) How to start and use the second X-Server
5) How to take control over it
6) How to use with Wine
7) Scripts
8) Wine example
9) Troubles
10) Credits and Links

1. Preface

The X-Server is the application that makes it possible to use graphical user interfaces (GUIs). There you can use your mouse and play games. So if you use KDE/Gnome or an other WindowManager you already have an X-Server running. It is possible to run multiple instances on different screens with different WindowManager. This Howto now tells you how to use a second X-Server for gaming.

2. Why to use an extra X-Server

There are many reasons why to use a pure server in addition:

  • more then one surface.
    So you can just jump to your working desktop and write an mail while you have to wait for a ingame-respawn.
  • better perfomance
    because your WM is now backgrounded.
  • No interrupts
    because of popups from Instant Messengers or sth. else, which may defocus and thus kill or at least interrupt a game.
  • Impression.
    if you go to lan and just switch around within all your games to decide which one to play now (that might require an SMP system though).

3. What is $DISPLAY

If you have a X-Server running there is a variable in this environment called $DISPLAY. So if you open a terminal within your WindowManager (i.e. konsole, xterm, eterm) and enter:

linux $ echo "My X runs on" $DISPLAY
you should get a:

My X runs on :0.0
This variable describes the address of your current working X-Server, is set by starting it and only availible within it self.

4. How to start and use the second X-Server

We now want to start one more X-Server:

linux $ X :1.0
You now see the mousepointer in the middle of a gray backgrounded screen. This indicates that your second X started fine. You can switch between X-Servers by using the [CTRL]+F* key-combinations:

STRG + F7 (:0.0) the first screen SRTG + F8 (:1.0) the second screen and so on...

5. How to take control over it

You can now go back to your first (:0.0) screen and start an application in the second one using this:

linux $ xterm -display :1.0
this parameter makes xterm start in an different display. If you now don't know the exact parameters for your applications to run on a different X you can also just change $DISPLAY. But note that if you do so, any program you launch from this terminal-instance will be shown on the other screen.

linux $ export DISPLAY=:1.0
linux $ xterm

6. How to use with Wine

You can create an AppDefaults-Section for the exe-file to use the second screen. Just add the following lines to your registry-file (system.reg or user.reg) or use regedit. Remember to change the test.exe into the executable you want to use.

[HKEY_CURRENT_USERSoftwareWine]
[HKEY_CURRENT_USERSoftwareWineAppDefaults]
[HKEY_CURRENT_USERSoftwareWineAppDefaultstest.exe]
[HKEY_CURRENT_USERSoftwareWineAppDefaultstest.exeX11 Driver]
"Display"=":1.0"

7. Scripts

If you hate to type all that everytime you want to play make a script to do it for you, or use xinit. This is how it works (with quake3 as example)

xinit-script: x.q3

#!/bin/bash
xinit /_path_to_your_quake3_binary_/quake3 $* -- :1

Set permissions and launch the script:

chmod +x x.q3
./x.q3

Legend

$*: You need this if you want to start quake3 with options/parameters. If you start x.q3 with +set fs_game wod the console tells x.q3 to start quake3-binarys with those parameters. --: this just tells xinit that the rest of the line defines the X-server-address (:1.0)

Note

You must give xinit the whole path to the binaries. Otherwise the X-server starts an xterm which most likely exits again because it doesn't know an option named "quake3" or similar. See the xinit manpage for more details.

8. Wine example

This time we need one more file. Some kind of start-script. This makes it much easier to manage the command.

xinit-script: x.callofduty

#!/bin/bash
xinit /games/init/cod $* -- :1

start-script: /games/init/cod

cd /_path_to_your_CoD_binary_/
wine -winver win98 CoDSP.exe $*

Set permissions and launch the script:

chmod +x x.callofduty
./x.callofduty

Note You need to set the Display part in your wine configuration.

Xgame For those how don't like scripting and want to have a grafical user interface (GUI) this might be an interessting link: XGame

9. Troubles

Trouble with permissions

You get something like this:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

xterm Xt error: Can't open display: :0.0

This indecates your writes are not enough to access this screen. If you don't now: It's deny to start any applications on the X of somebody else by default. Even root's access is restricted. But we can solve that problem by editing the .Xauthority-file using xauth.

linux $ xauth
xauth>

How you have an auth-prompt to edit the accesfiles. First lets see all entry for now:

xauth> list
0.0.0.0:0 MIT-MAGIC-COOKIE-1 68d682a4f137b4f4679248eybc36a7c5
xeroc/unix:0 MIT-MAGIC-COOKIE-1
68d682a4f137b4f4679248eybc36a7c5

As we can see we are only allowed to use :0. My MIT-MAGIC-COOKIE-1-Code is this: 68d682a4f137b4f4679248eybc36a7c5. Of course your MAGIC-COOKIE may look different. Please use yours. We now have to add Display :1.0:

xauth> add :1.0 MIT-MAGIC-COOKIE-1
68d682a4f137b4f4679248eybc36a7c5
and save:
xauth> exit
Note that 'quit' removes changes and exits then.

10. Credits and Links

[en]2 X-Server,2 Graphics cards, 2 Displays
[en]Two Xservers
[de]Zweiter X-Server mit 3D Beschleunigung (Update)
Last modified: 04.01.10 by GlaDiaC  

Comments
The comments are owned by the poster. We aren't responsible for their content.
Linux Games
Linux Games
Terms of Use · Privacy Policy · Creative Commons License · Credits · Linux Games · Linux Games · World Time · Vereins Intern