I found a howto on making multiple X servers.

drag

Elite Member
Jul 4, 2002
8,708
0
0
They say that they do it so that it's easier to play around with games and then switch back to their desktop without screwing anything up.

Ctrl-alt f7 to the main desktop
ctrl-alt f8 to the game.

simplistic howto, here

Actually seems realy nice.

For instance I have ut2004 and dual monitors. Now ut2004 can't handle dual monitors, or at least not how I have it set up. And I don't realy want to use dual monitors on it anyways.

So what I did to fix this was that I went into my X configuration and setup 2 layouts. One layout is the default, and the 2nd layout is for a single monitor, and that is named "gaming".

So what I did was then aliased a command to "gamex". The command was "startx -- -layout gaming".

And that worked, but it sucked because I would have to kill X then go back to console and then restart X with a different layout.

It was either that or run the game in window'd mode, but that is irritating for me to use.

Then my icons on my nautalis file manager would get all messed up anyways.

However now that I know that I can have multiple X servers this is what I do:

startx in one console. Let it start. ctl-alt f2 into the second console. Then I do this command:
X --layout gaming :1.0

And that starts the second X server, with no window manager or anything. Then I go back to the first X server, my main one. Then I open up a xterm and do this command:

DISPLAY=:1.0

And now my commands will be executed in the other display. Now I can go "ut2004" then switch to the second X server and I have full screen action!! Any time I want to go back I just hit "ctl-alt F7" to go and ping, or change the music, or write a email in a boring bit. Then I go back with "ctl-alt F8".

Of course it's not perfect as most games assume that your running only one X server, but this is cool anyways. Doesn't work with DRI I think, at least on my laptop I loose 3d acceleration on my second X server, but I think that the original is still accelerated.

Hell you could probably do something nuts like run Gnome in one display and run KDE on the second.

Then you can do other cool stuff. Like running multiple seperate desktops. Over networks.

On the xterm with $DISPLAY set to :1.0 I ssh'd into my laptop.

On their I have KDE installed, but I don't on my desktop, so I wanted to see if it would work.

AND IT DID! (geek happiness)

# echo $DISPLAY
localhost:1.0

# startkde

And it works! I hit ctl-alt-F8 and I surfed around on konquerer for a bit, running from my Laptop thru a ssh tunnel then I switched back to my regular Gnome desktop with a simple ctrl-alt-F7. Of course my laptop's wireless card is flipping out, but it's not that slow at all over 54Mb/s connection. Don't think I'll be playing any games over it any time soon, though ;)

Hell the Xscreensaver kicked in even from my laptop to my desktop just now.

X windows rocks.
 

Booty

Senior member
Aug 4, 2000
977
0
0
A lot of this post is way over my head, since I'm far from a seasoned linux user, but I found it pretty cool nonetheless... thanks for sharing! :)
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Well here is a summary, I got a bit long winded.

Ok, say you have X running. Thru a graphical login manager, or a startx command from a virtual console. That's already setup and has your desktop on it.

Now you hit "ctrl-alt-F1" or any of the F# keys 1-6 in order to get ahold of a virtual console.

Log into it as your user.

At the command prompt type:
X :1.0

And that will start another X session. Although unlike the first this will just be X, with no Window manager or anything. Basicly a nasty gray screen with a ugly "X" cusor you can move around and that's about that. That's a basic X server, it require other programs to give it more functionality, those programs are X clients, and they run from the X client server (which is the same PC as your X server most of the time, basic default desktop setup so that it seems like a desktop OS like OS X or Windows)

Now you hit "ctrl-alt-F7" to get back to your original X session.

Open up a terminal, in the terminal type this command:
DISPLAY=:1.0

And that will tell the commands you use that you want to use :1.0 X windows instead of your default one. (which is usually :0.0)

Now you can send commands. For instance start a simple Window manager, I used Openbox. Although Fluxbox, Icewm, Blackbox, Enlightenment, will provide window manager functionality without much overhead. Try Icewm if you got it. Icewm is a simplistic window manager that has support for Gnome (and KDE I think) apps. Low overhead so that running it shouldn't bog down your computer if your running a full featured desktop manager like Gnome or KDE. Although you can run Gnome or KDE if you want in the second manager just fine.
The command to start xv is:
icewm &

And that should open icewm on the next screen. Now you have 2 functional X servers going.

Now here is something else. If your using a little WM like Icewm, youre root window will probably stay that ugly gray color. To fix that it's easy to set the backgroud or use a very special little program called "xv". Xv is a wonderfull little image viewer designed specificly for X windows and can assign images to your root windows.

If, for instance, you have a folder that contains a great number of jpegs or other images that you like to use for your backgrounds occasionally, you can use xv to display them, and it's flexible. For instance if that folder is named "images" go like this:

cd images
xv -wait 300 -wloop -smooth -max -root *.jpg

And that will create a slide show for your background. The wait number is in seconds and this set to change the background every 5 minutes. you can get some very nice backgrounds at mackdesktops

Won't work if your using KDE or Gnome, since their file managers fill up the root window and use their own background setup.
 

Booty

Senior member
Aug 4, 2000
977
0
0
So basically, startx and into Xwindows, as normal... ctrl-alt-F2, login, X:1.0, ctrl-alt-F7 back to original X session, then open up a terminal and issue DISPLAY=:1.0 and from then on out any commands issued at the terminal will be executed on the other session? So then I could run quake3, ctrl-alt-F2, and I'm ready to frag? Or I'm running Dropline on F7 and fluxbox on F2? I might have to play with this a bit tonight...

I run dual monitors as well, and after I initially set them up, I realized that Quake 3 (the only game I've messed with under linux at this point) wasn't too happy anymore... at least not when I just launched it from DLG's menu. Granted, I haven't really tried to get it to work, but anyway...

I also need to get around to messing with Fluxbox some more... I look around the web at screenshots of people running it, and they've done some really cool stuff with it...
 

drag

Elite Member
Jul 4, 2002
8,708
0
0

Almost right. You need a space there between the X and the :1.0. "startx" is a front end to the "X" command. X starts xinit or something like that. Not sure of the details.

For instance I have a 2 layouts in my X windows config:

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection

Section "ServerLayout"
Identifier "Gaming"
Screen "Gaming Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection

So when I go "startx" it uses the default setup. To start using the gaming layout you go "startx -- -layout gaming". That -- sends the command to X, so to run X in "F8" with the gaming layout you go "X -layout gaming :1.0". So that way I have one X server running both monitors and the second running a single monitor.

(for the rest of my XFree86.conf check out ftp://68.99.10.191/XF86Config-4)

So ya you could run dropline in one X server and then fluxbox on a completely seperate one. Also since X is a networking protocol, and not just a GUI you could run X clients from other computers on your local X server.

So you could have your desktop's GUI running on "F7", and then have a remote file server's X session running over the network on "F8", kinda like a VNC session.

The $DISPLAY variable tells gui apps what X server to send GUI output to. It's not all peaches and cream, there are some security issues and authentication issues you run into time to time. Personally I setup SSH to allow X clients to be tunnelled thru the connection. So I can do stuff like ssh into my Desktop from my laptop and then run my desktop's install of evolution locally on my laptop when I want to check my e-mail (from anywere in the world that has a decent internet connection)

If you have a secure network you can go ahead and run X directly on the network, and also their are other tunnels/VPN's you can use that have less overhead/cpu usage then SSH (but SSH is convienent and easy to setup and use). There are lots of howtos on howto setup X forwarding and X authentication to work over a network.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Wow, you're really happy about this. I always thought it was just kinda part of X. Though it is nice for games, as you describe - I've done similar stuff for games with dodgy WineX support that don't play well with window managers. If you continue playing around with the setup, I'd be curious to see if you find out anything about AGP/DRI. In my experience, the acceleration would seem to fail randomly when I started a second screen - sometimes it would "stick" on the first one, sometimes both would break, or the second would take over, etc. I never saw a pattern to it.

It's not a good substitute for real dual screens with Xinerama, however. At least for GNOME, you get some weird glitches caused by lock conflicts between gconf instances (I suspect - never looked that closely). Don't know about KDE, but I wouldn't be surprised if it were similar.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
I never noticed it before (don't ask me why). It helps out with a lot of stuff.

Never tried Gnome on it much, but I'd bet that having 2 gnomes under the same user using the same X client machine would cause problems. Locks would be irritating, for instance try starting 2 instances of Mozilla. Worked fine running KDE from a different desktop.

No problem with 3d acceleration, The score was a bit lower on glxgears on the alternative display, 4500 fps vs 4250 fps, but that's not a big deal. Doesn't work with my laptop's DRI stuff, but it's still stable.

If I wanted more screen space I'd just open up another "workspace" (gnome's terminology for multiple desktops or whatever). That's much better, you can move windows back and forth and stuff.

But for games like ut2004 (can't handle dual monitors worth a crap), or running multiple desktop/Window managers from other computers it's realy cool.

For running multiple desktops I suppose you could always use Xnest to run a "nested" X server in a client.. (that is running a seperate window that operates like a whole new X server).
 

Giantwasp

Member
Jul 22, 2004
128
0
0
Thanks for this post I think it will be very useful to me. I am building a Linux dual screen gaming machine at present. And when I finally solve some more fundamental issues I will be setting up some games on it, like Doom3 and UT2004. I kind of assumed that a game would ignore the second screen when it was run, as it seems like it causes a problem this info will be very handy.
 

manly

Lifer
Jan 25, 2000
12,906
3,682
136
Welcome to the last millenium. :p

When will X-Windows support a seamless "switch user" like OS X Panther or Windows XP?