How to automate the process of running games installed trough wine?

I have Witcher 3 installed trough wine.
I use Gnome
It’s in custom prefix

Now every time I want to play I need (probably not, but I don’t know the different way) to repeat steps in terminal:
export WINEARCH=win64
export WINEPREFIX=~/Games/W3
wine ~/patch to Witcher executable

Could you put those into a shell script

#!/bin/bash
export WINEARCH=win64
export WINEPREFIX=~/Games/W3
wine ~/patch to Witcher executable

and save that script as run_witcher.sh

run

chmod +x run_witcher.sh

and now at least you can run that script instead of typing that out. Can also double click it if it’s on desktop I think

I think there might be a better way to create a desktop shortcut where you can use an icon, which you can point at your new script as well. For me, I can right click the desktop, say “create a new launcher here”, and link it to the script. That’ll let you customise the icon too.

2 Likes

You can create a Bash script, or a desktop files, containing the required variables/commands.

Example for a Bash script:

#!/bin/bash
# 
export WINEARCH=win64
export WINEPREFIX=~/Games/W3
wine ~/pathToWitcherExecutable

Save the file as whateverName.sh, make it executable, and you can now launch from terminal or right click probably, this script

For a .desktop file I guess it would be something like:

[Desktop Entry]
Name=Game Name Here
Comment=My Game description Here
Exec=WINEARCH=win64 WINEPREFIX=~/Games/W3 wine ~/pathToWitcherExecutable
Icon=iconNameHere
Terminal=false
Type=Application
Categories=Game;

I think you can have Terminal=true/false it shouldn’t break anything either case

Place the .desktop file in ~/.local/share/applications/ it should appear in your desktop menu now.

One better solution is to use Lutris, but this is a whole another guide by itself, check wikis/google/forum. Lutris is great to manage containerized Wine programs, each program in its prefix. You could simply ‘create’ an application in Lutris and configure it to use your existing prefix and files :wink:

2 Likes

I checked and it seems that desktop file hass been created automatically.
(I don’t have icons on the desktio so I didn’t notice)
There is:

[Desktop Entry]
Name=The Witcher® 3 - Wild Hunt
Exec=env WINEPREFIX="/home/jm/Games/W3/" /usr/bin/wine C:\\windows\\command\\start.exe /Unix /home/jm/Games/W3/dosdevices/c:/users/Public/Pulpit/The\ Witcher®\ 3\ -\ Wild\ Hunt.lnk
Type=Application
StartupNotify=true
Path=/home/jm/Games/W3/dosdevices/c:/
Icon=8030_goggame-1495134320.0

But I can’t open it with mouse because it is being open in LibreOffice

Indeed it seems it is a properly created one, it may indicate that my guess was maybe not as good if you check the difference in the EXEC= line.

As you have GNOME, I remember (from 10 years ago, or something like that) that there was in the file manager some settings to execute or open executable file or ask what to do, when double clicking an executable file (script or whatever). Maybe check the settings then of your file manager.

//EDIT: did you try to launch it from the application menu? Don’t open the .desktop file from file manager, just find it in your application menu, after it is placed where I told you.

You are right. There is such option. It helped partially. When I choose to run the game the popup window appears with information that file can not be found

I edited above post in case you didn’t see

I use Lutris to install and run all non Steam games. You can find it in the repos. You can set different winprefixes and other options for every game.

1 Like

I copied desktop file from actual desktop to ~/.local/share/applications/
I have Witcher 3 “shortcut” in Gnome applications but when I run it something that looks like Windows file explorer is openes

I mean I use lutris to manage all mine, you can set custom prefixes and all that good stuff in the client, then just click the button to launch the app.

Can you be more specific? Which desktop file did you start? Did you try mine?

Why not use PlayonLinux?

In gnome I don’t have icons on desktop. But there is desktop directory in my /home
I didn’t notice earlier but during the installation .desktop file has been created by the Witcher installer (or by the Wine).
It contains what I mentioned in post How to automate the process of running games installed trough wine?

I didn’t have time to try yours.

I would like to learn how it works. Then I’ll use everything else :slight_smile: