HOWTO: Allow Alt-tab and speed up Spring (separate X server)

HOWTO: Allow Alt-tab and speed up Spring (separate X server)

Discuss everything related to running Spring on your chosen distribution of Linux.

Moderator: Moderators

Post Reply
CautionToTheWind
Posts: 272
Joined: 30 May 2006, 17:06

HOWTO: Allow Alt-tab and speed up Spring (separate X server)

Post by CautionToTheWind »

I am running Kubuntu Edgy and I had 2 problems with Spring:

- No alt-tab with fullscreen spring
- Unreliable edge map scroll with "fake" fullscreen modes that did allow alt-tab
- Shaky performance with "fake" fullscreen modes

On my wanderings on the internets i was lucky enough to find the idea of running games on a separate x server. It allows you to alternate between your regular desktop (CTRL+ALT+F7) and the other X server with spring (CTRL+ALT+F9 on my setup). This also has the additional effect of backgrounding all your desktop stuff so that it eats less memory and cpu, so you get that extra frame per second and lose the little FPS drops that happen when the cpu scheduler starves spring.

This is my first howto and is mostly a copy of several resources i found online. What was available was outdated and needed some updating, plus i had to deal with some extra problems on my setup.
Original: http://ubuntuforums.org/showthread.php?t=51486

So lets paste:

1. First to allow you to run a new X display you need to:

Code: Select all

sudo dpkg-reconfigure xserver-common
Then make sure you change the first option to "Anybody" and hit enter twice.

2. Next we have to set your ~/.Xauthority file up. This may look tricky but it's very straight forward, all you need to do is add a line using a special key we find. So, in a terminal type:

Code: Select all

xauth
list
And you should get an output something like this:

Code: Select all

ananke/unix:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
Yours WILL be different, thats ok. Now we need to add a new line and then exit to save it. So we type in "add :1.0 MIT-MAGIC-COOKIE-1" followed by that long alpha numeric string but remember to use yours. So for me I would type the following:

Code: Select all

add :1.0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
exit
3. Create the script "spring":

Code: Select all

cd
kate spring
And paste the following:

Code: Select all

#!/bin/bash
xinit /usr/games/_spring $* -- :1
Save it.

4. Now we need to make it executable, rename spring and put this script in its place:

Code: Select all

chmod a+x ./spring
sudo mv /usr/games/spring /usr/games/_spring
sudo mv ./spring /usr/games/spring
5. That's it. Run "spring" in a terminal, Spring should run on a new X server. To access your desktop you need to press CTRL+ALT+F7 and to return to spring use CTRL+ALT+F9.

I tried to make this perfectly compatible with det's HOWTO to use the windows lobby with wine and native spring. It works for me.

PROBLEMS:

1) X crash when returning to main screen (CTRL+ALT+F7) if running beryl.
Workaround: Disable Beryl before running spring by right clicking the beryl-manager icon on the systray and then picking "Select Window Manager" and picking the one that is not beryl (in my case, KWin). Maybe this step could be automated somehow? Help is welcome.

2) If you want to run spring the old way just run "_spring" from a terminal. If you want to revert the renaming and replacing, do:

Code: Select all

sudo mv /usr/games/spring /usr/games/spring.x
sudo mv /usr/games/_spring /usr/games/spring 
IDEAS:
- Automate Window Manager switch. Solution in the replies
- Since i'm running a script instead of spring i might as well customize. The TASpring.exe wine process stays at 1% and up to 5% cpu usage at times. I find that unaceptable so i'm thinking of killing the wine process in this script. It will look like you left the lobby as soon as game started, but you will still be in game.
edit: To kill the process, edit your /usr/games/spring script so that it looks like this:

Code: Select all

#!/bin/bash
killall TASClient.exe
xinit /usr/games/_spring $* -- :1.0
Last edited by CautionToTheWind on 16 Jan 2007, 16:12, edited 1 time in total.
Nonor
Posts: 19
Joined: 28 Dec 2006, 01:21

Post by Nonor »

Just to add smthg about beryl : that's right, you have to disable it before launching another X server. But you can do it automatically, by sending the USR2 signal to the beryl-manager process. Then do it again to activate it back. It will just switch between beryl and the rescue window manager.

killall -USR2 beryl-manager
CautionToTheWind
Posts: 272
Joined: 30 May 2006, 17:06

Post by CautionToTheWind »

That is very good. The spring script that we create could then instead be:

Code: Select all

#!/bin/bash
killall -USR2 beryl-manager
xinit /usr/games/_spring $* -- :1 
killall -USR2 beryl-manager
Thank you Nonor.
User avatar
Relative
Posts: 1371
Joined: 15 Oct 2006, 13:17

Re: HOWTO: Allow Alt-tab and speed up Spring (separate X server)

Post by Relative »

Can someone update this a bit for 7.10 and 8.04? The package mentioned in the first step no longer exists and hasn't for a long time. Things have changed quite a bit since edgy.

Edit:
Nm, I've created a new one
User avatar
albator
Posts: 866
Joined: 14 Jan 2009, 14:20

Re: HOWTO: Allow Alt-tab and speed up Spring (separate X ser

Post by albator »

Works good, but , I had to edit a file casue lack of priviledge on Xserver


http://karuppuswamy.com/wordpress/2010/ ... -aborting/



Also, another question.

Is there possible to run other apps in separate X ? I mean I love music with it.
In init below Graphic I still got it (e.g F6), after I loaded F7

Since I dotn have terminal access in 2nd X server I cannot do anything . Any idea ?


PS: my music player got a GUI. (gbrowser)
Post Reply

Return to “Linux”