Fun With Wine

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
red-e-made
Level 5
Level 5
Posts: 526
Joined: Sat Jul 14, 2007 11:31 am

Fun With Wine

Post by red-e-made »

Hey there!

This information might actually only be helpful to a very small number of people here, but I thought I would post this little discovery, for the handful of people who might benefit from it.

For those of you who use Wine, more than likely your Wine programs are somewhere in /.wine and appear in your MintMenu under the Wine category of Programs. However, just as it's possible to put Wine-run programs in any directory you please, you can also run the .exe files of these programs directly from your MintMenu under any category you like, with the use of the "winebrowser" command followed by the file path to the .exe file.

For example, let's say you have a Wine-run game in the directory /home/MintFan/Desktop/Games, and the file path that runs this game is /home/MintFan/Desktop/Games/Space_Battle/SP.exe. Normally, you would have to open this directory and click the .exe file (provided you have it already set to be opened with Wine Windows Program Loader) in order to run it. Well, you can spare yourself those clicks through the path to the .exe by doing the following:

1. System>Preferences>Main Menu>Games>New Item
2. Name it what you like (in this example, Space Battle)
3. Give it the command: winebrowser /home/MintFan/Desktop/Games/Space_Battle/SP.exe
4. And close

From this point on, you can now run the game in Wine straight from Games.

I realize this a little trick that saves you a couple clicks while still letting you keep Wine-run apps wherever you please, but for me, I don't like to have all my Wine apps crowded into a single directory in my Home folder, and I like having my apps wherever I want in MintMenu, instead of having those programs which use Wine segregated under the Wine subsetting.

Just a little thing to give you a bit more freedom in your day-to-day use. Cheers!
tkocou
Level 2
Level 2
Posts: 82
Joined: Mon Jul 30, 2012 6:25 pm

Re: Fun With Wine

Post by tkocou »

Let's take your great tutorial a bit farther. On 64 bit machines running the 64 bit version of Linux Mint, when you install wine, you get a 64 bit version. All fine and dandy, however, Windows games are generally 32 bit programs. So, is there a way to force wine to be natively 32 bit on a 64 bit Linux Mint? YES and here is how:

Start in your home directory.
Rename the default .wine directory:

Code: Select all

$ mv .wine .wine-64
Invoke the winecfg with an environment setting:

Code: Select all

$ WINEARCH=win32 winecfg
Verify the 32 bit setting with a quick check:

Code: Select all

$ head ~/.wine/system.reg
The arch line should read:

Code: Select all

#arch=win32
Now building on having the Windows programs in a different directory (as listed above), let's make a new default wine directory.
If not already existing, create a directory called 'wine32'

Code: Select all

$ mkdir wine32
Copy the contents of the newly created 32 bit .wine directory:

Code: Select all

$ cd .wine
$ cp -afv * ~/wine32
$ cd
Now let's tell wine to use this 32 bit environment:

Code: Select all

$ nano .bashrc
And add these lines:

Code: Select all

export WINEPREFIX="/home/<your user name>/wine32"  # <- WINEPREFIX must be an absolute path!
export WINEARCH=win32
And save it. Log out and log in. Check your settings with:

Code: Select all

$ printenv
And look for the WINEARCH & WINEPREFIX variables.

Have fun. If your program requires native DLLs, you can use winetricks (in the repository for Linux Mint):

Code: Select all

$ winetricks d3dx9
Update:
There are subtle differences between a shell invoked within a shell script and via a terminal window. What may work perfectly when invoked in a terminal window, may crash and burn when you attempt to automate the process via a shell script.

Here is my methodology for getting a shell script to function just like doing it by hand. It is not the only way to do this, but it works.

Code: Select all

#!/bin/dash
# Specified shell to use (above line)
# This shell script assumes that you are starting in your home directory
# Setup environment variables next 2 lines
export WINEPREFIX="/home/<your user name>/wine32"  # <--- WINEPREFIX must be an absolute path
export WINEARCH=win32
# now get to the target directory and then invoke the program under wine
# NOTE: spaces in the directory names must be escaped with a '\'
cd wine32/drive_c/Program\ Files/Stardock\ Games/Sins\ of\ a\ Solar\ Empire; wine Sins\ of\ a\ Solar\ Empire\ Entrenchment.exe
# Lastly, exit 'no errors'
exit 0
Last edited by tkocou on Sun Jun 07, 2015 4:22 pm, edited 1 time in total.
Linux Mint 21.1 Cinnamon
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Fun With Wine

Post by Flemur »

Good info.

FWIW, I don't have to
export WINEPREFIX="~/wine32"
export WINEARCH=win32
for a 32 bit prefix.

Here's how to make a wine program act like a regular linux program.
FIle ~/bin/iview (executable) :

Code: Select all

 #!/bin/sh

QUICKPARLOCATION="c:\\pgms\\IrfanView\\i_view32.exe"
PARAM=`winepath -w "$*"`
wine "$QUICKPARLOCATION" "$PARAM" &
exit 0
(Programs are installed in C:\pgms rather than under "Program Files").

Then you can
File-manager(thunar,etc) -> rt-click on a file -> Open with -> iview
or
$ iview file.jpg
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
tkocou
Level 2
Level 2
Posts: 82
Joined: Mon Jul 30, 2012 6:25 pm

Re: Fun With Wine

Post by tkocou »

That is good to know information. Thank you. The nice thing about making a copy of the .wine directory: as you explore various tactics to get a Windows program running under wine and mess up the wine configuration; to recover, all you have to do is delete the wine32 directory, remake the directory, copy over the .wine directory and start over with that program.
Linux Mint 21.1 Cinnamon
User avatar
Pjotr
Level 24
Level 24
Posts: 20090
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Fun With Wine

Post by Pjotr »

Note that Wine, although a technological miracle, creates serious security risks.... Because it also allows Windows *malware* to run in your /home.

That's why from a security perspective, a dual boot (or a Virtual Machine) with Windows is the preferred solution, for those Windows applications that you still need. :)
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
tkocou
Level 2
Level 2
Posts: 82
Joined: Mon Jul 30, 2012 6:25 pm

Re: Fun With Wine

Post by tkocou »

Pjotr wrote:Note that Wine, although a technological miracle, creates serious security risks.... Because it also allows Windows *malware* to run in your /home.

That's why from a security perspective, a dual boot (or a Virtual Machine) with Windows is the preferred solution, for those Windows applications that you still need. :)
Thank you for the advise. Nobody would dispute the security risks involved with using any Windows based program. The ideas presented in this tutorial is intended for the occasional Game or Utility program and certainly not to replace Linux Mint. I have older Windows based games which will never have a native Linux version. So I use DOSBox and wine to runs these programs.
Linux Mint 21.1 Cinnamon
Post Reply

Return to “Tutorials”