Setting Windows File Associations in Wine

May 22, 2012 - Reading time: 3 minutes

Wine Association Creator

When running an application in Wine recently I noticed that if my application wanted to open a Word document or Excel spreadsheet it failed because Office isn't installed in Wine, even though I had LibreOffice installed natively in Linux. The same goes for PDF documents which fail because I don't have Adobe Reader Installed, I have Okular already installed in Linux.

When searching the net for a solution all I came across were registry edits and a couple of command line scripts. So I decided to write a simple application in Qt/C++ to make the process easier.

After downloading wineassoc simply double click on the file (you may need to make it executable first, right click and change file permissions) or from a console run ./wineassoc in the directory you downloaded into. From console you can make the file executable using "chmod u+x wineassoc". You will be presented with a window as shown here in the screenshot. Simply select which file extensions you wish to associate to native Linux applications and then click Add >> to move them to the right hand column. When you have selected all the required types, click Apply. Note that wineassoc honours the WINEPREFIX setting and will prompt for confirmation before proceeding.

The extension list is populated using Linux config files, with a few extras added in. If by chance your extension is not shown you can start wineassoc from the console specifying extra extensions manually. For example ./wineassoc abc def would add 'abc' & 'def' to the association list. You can also hover your mouse over an extension type to show what programs are associated to that type.

The program should run on most Linux systems that have Qt 4.8 Qt 5 or later. Please let me know if you have problems with a particular distro and Ill try to look into it. This version has been tested with Wine 4.0.3 & Wine 6.0 and was built using Qt5.

 Download wineassoc using the link below:

Find this utility useful? Leave a comment or consider a purchase from our website.

WineAssoc is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Luis
Written by Luis on October 4, 2023
It works perfectly on fedora 38, is it possible to add new file types? Like json or someone not on the current list?
Admin Admin
Written by Admin on August 26, 2024
If you launch it from a terminal you can add additional types on the command line, for example the following command will add the file types "abc" & "xyz" to the list. Unfortunately only three letters extensions at the moment: $ ./wineassoc abc xyz
Bill
Written by Bill on September 5, 2021
I've done some updates to 'wineassoc'. It is now compatible with Wine 6.0 and Qt5. Enjoy :)
Bill
Written by Bill on June 11, 2015
Hi All, WineAssoc is back! I've updated it to check more locations for extensions, so should work with more distros. It is also now compiled with QT 4.8 and only in 64 Bit.
Demanche
Written by Demanche on January 14, 2013
Hey there, yeah, I know, takes for ever for me to reply. I am currently running QT 4.8.2 wine If I run from a terminal window within fluxbox (my personal favorite WM), the program seems to just launch without errors or failures, and as expected if I run it from terminal outside of flux I get the expected cant connect to X server.
Bill
Written by Bill on January 7, 2013
Hi Lorax, The files should be accessible now. Was an issue from a change of server. Thanks for letting me know.
Lorax
Written by Lorax on January 7, 2013
The links appear to be dead, any chance of re-uploading WineAssoc?
Bill
Written by Bill on November 3, 2012
@Demanche Do you have the QT 4.6 or higher libraries installed? When you run from the console are there any errors listed? @OR Glad you like WineAssoc, you are of course correct that I should write to the /tmp dir. At the moment its just a quick project, if there`s enough interest Ill clean it up and improve the interface a bit. I don`t think there`d be any licencing issues. Not sure it would ever make winecfg, but maybe a link on WineHQ in the 3rd Party Tools? Anyone?
OR
Written by OR on November 1, 2012
Nice tool! Thanks! IMHO the wineassoc.reg file should be written to /tmp. Is the licence compatible with Ubuntu so WineAssoc might be packaged there? From a user perspective it should ideally go into the official winecfg.
Demanche
Written by Demanche on October 27, 2012
addendum to last entry.. I am entering WineAssoc. not WinAssoc as typed.
Demanche
Written by Demanche on October 27, 2012
I`m running Slackware 14.0 and using Fluxbox ver. 1.3.2 as my window manager. I`ve downloaded the WineAssoc file into ~/usr/bin/. I did [casa]> chmod 766 WinAssoc. When I ran the file I did not get any entries in either the Add or Remove columns. Per the site I could manually add them, so I attempted: [casa]> WinAssoc pdf I get the same results no entries in either column Just in case its needed here is the version of Wine I`m running [casa]> wine version wine 1.4.1. Am I doing something wrong or have I missed a step somewhere?
RD
Written by RD on June 4, 2012
The 64 bit version works.
Bill
Written by Bill on June 2, 2012
Hi RD, Thanks for the feedback. I didn`t actually create a 64 bit version as my 32 bit just worked on my 64 bit system. I have now created it anyway and added it to the download list. If you can give that one a try and see how it goes. If you still get the same error, I will attempt to create a version of the application with static libraries.
RD
Written by RD on June 2, 2012
It doesn`t work on openSUSE 11.4 x86_64. Clicking on the file in Konqueror just brings up the Open with dialog (yes, I did make it executable). The first time I tried to run it in a terminal, I got the message error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory even though I had that file installed. I figured out that I needed to install the 32 bit package, too. You should mention this in your instructions. After installing libqt4-x11-32bit, the message I get from running it in the termianl is ASSERT failure in QList::operator[]: index out of range, file /usr/lib/qt4/include/QtCore/qlist.h, line 447
Bill
Written by Bill on May 24, 2012
Hi Z.K, Thanks for the feedback, glad it works for you. The .reg file contains the commands generated by WineAssoc that are then fed to regedit to update the registry. It is mainly there for debugging purposes and can be safely deleted. You should be able to use your native linux File Associations to set which program is run. In KDE it is under Configuration->Configure Your Deskop->File Associations. I imagine a similar system exists for Gnome. WineAssoc collects its file association information from the /usr/share/applications/defaults.list file (at the moment it only supports the three letter extensions).