This tutorial will explain you how to redirect the output of scorched3d to a separate X session (grafic session) to be capable to switch between the desktop & the game with a simple key combination.
in this turial we assume that your default X session is #0, so, we'll add a new session #1, also it's assumed that the path to your scorched3d binary is /usr/bin/scorched3d, you might have to customize them according to your distribution/installation
switching between them will act like Alt+Tab, the shortcut keys are:
- Ctrl+Alt+F7 for the session #0 (desktop)
- Ctrl+Alt+F8 for the session #1 (game)
Ubuntu
if your distro is ubuntu, you'll have to do the following step in order to continue:
- sudo dpkg-reconfigure xserver-common
wich creates an X authorithy file in your home folder
Configure X Authority File
as regular user launch the command:
- auth
inside the application, send the command:
- list
you should get an output similar to the following:
- yourhostname:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
- localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
yours might be DIFFERENT, it's normal
now we'll add a new key for the X session #1 by typing add :1.0 MIT-MAGIC-COOKIE-1 and copying the long string in at the end of the line wich starts with your yourhostname:0
eg, in this case:
- add :1.0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
we can check the result by sending the list command again:
- yourhostname:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
- yourhostname:1 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
- localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
when done, send the command:
- exit
Create the Launcher Script
open your favourite text editor (in this tutorial kwrite) and create the script scorched3d:
- cd
- kwrite scorched3dc
add the following lines in it:
- #!/bin/bash
- xinit /usr/bin/_scorched3dc $* -- :1
Beryl Users
beryl crashes when launching another X session, we can temporaneally disable it while running the game by sending the USR2 signal; so the script becomes:
- #!/bin/bash
- killall -USR2 beryl-manager
- xinit /usr/bin/_scorched3dc $* -- :1
- killall -USR2 beryl-manager
save & close the file
to make the script executable like a binary, you need to send the command:
- chmod a+x scorched3dc
Move the script in place
Ubuntu
rename the current game binary:
- sudo mv /usr/bin/scorched3dc /usr/bin/_scorched3dc
replace the call with the new script:
- sudo mv ./scorched3dc /usr/bin/scorched3dc
All distributions with su command enabled
get superuser privileges with the following command:
- su
rename the current game binary:
- mv /usr/bin/scorched3dc /usr/bin/_scorched3dc
replace the call with the new script:
- mv ./scorched3dc /usr/bin/scorched3dc
that's it! when you'll start a game, the video will be redirected to the session #1 instead of #0