Tech Notes, Tips & Reviews

Setting Windows File Associations in Wine

May 222012

WineAssocWine 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.


Z.K.23 May, 2012Thanks, this works great. One question though. When I run it, it puts a *.reg file in the same directory as where I ran the script. Is that just a backup? Also, maybe if in the future you update this, add the ability to set a particular program as the default application for the file type.
Bill24 May, 2012Hi 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).
RD02 June, 2012It 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: 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 Aborted.
Bill02 June, 2012Hi 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.
RD04 June, 2012The 64 bit version works.
Demanche27 October, 2012I`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?
Demanche27 October, 2012addendum to last entry.. I am entering WineAssoc. not WinAssoc as typed.
OR01 November, 2012Nice 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.
Bill03 November, 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?
Lorax07 January, 2013The links appear to be dead, any chance of re-uploading WineAssoc?
Bill07 January, 2013Hi Lorax, The files should be accessible now. Was an issue from a change of server. Thanks for letting me know.
Demanche14 January, 2013Hey 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.
Bill11 June, 2015Hi 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.
Bill05 September, 2021I've done some updates to 'wineassoc'. It is now compatible with Wine 6.0 and Qt5. Enjoy :)

New comment