Running Wine games in a different X session

Hey guys!
In this tutorial I'll show you how to run WINE (Wine Is Not an Emulator) games in a different X session than your current one. (Credits: Ubuntu Forums) This tutorial will use Ubuntu (will work generally with Debian)
First, open a terminal and type:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install wine
Once it's done, download your favourite Windows game (I recommend OpenHexagon :)). Now, create a new bash script with the following contents (script taken from the credited link):
#!/bin/sh
#uncomment if launching from console session
#sudo /etc/init.d/gdm stop
#KDE use this instead
#sudo /etc/init.d/kdm stop

# Launches a new X session on display 3. If you don't have an Nvidia card
# take out the "& nvidia-settings --load-config-only" part
X :3 -ac & nvidia-settings --load-config-only

# Goto game dir (modify as needed)
# cd "
~/.wine/drive_c/<WHEREVER_YOU_INSTALLED_IT>"

# Forces the system to have a break for 2 seconds, X doesn't launch instantly
sleep 2

# Launches game (modify as needed) and kills X server
# after close
DISPLAY=:3 WINEDEBUG=-all wine "<GAME_EXE>.exe" && kill $!
Now, save it and make it executable by entering the following in the terminal:
chmod +x <SCRIPT_FILE_NAME>
Before you run it, you have to take care of a few things. Open "/etc/X11/Xwrapper.conf" and change the following line:
allowed_users=console
To:
allowed_users=anybody
Save it and then in the terminal, run:
sudo usermod -a -G audio <YOUR_USER_NAME>
This will add your user to the ALSA audio group (for audio). Now, set your sound volume and then launch the script using:
bash <LOCATION_OF_SCRIPT>
or (if the script is in your current directory):
./<SCRIPT_FILE_NAME> 
It should start your game in a different X session. To get back, press Ctrl+Alt+F7. The script should kill the X server after closing the game.

Cheers!
-Technohacker

Comments

Popular Posts