Setting Windows file associations in WinePosted on May 22nd, 2012 12 comments
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” or “WineAssoc64″ simply double click on the file (you may need to make it executable first) or from a console run “./WineAssoc” or “./WineAssoc64″ in the directory you downloaded into. 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.6 or later. Please let me know if you have problems with a particular distro and I’ll try to look into it.
Download “WineAssoc” using the links below.
Find this utility useful? Consider a small donation to help cover hosting costs, etc.
WineAssoc is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
12 responses to “Setting Windows file associations in Wine”
Thanks, 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.
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 it’s file association information from the “/usr/share/applications/defaults.list” file (at the moment it only supports the three letter extensions).
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
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.
The 64 bit version works.
Demanche October 27th, 2012 at 07:53
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 it’s needed here is the version of Wine I’m running
[casa]> wine –version
Am I doing something wrong or have I missed a step somewhere?
Demanche October 27th, 2012 at 07:54
addendum to last entry.. I am entering Win’e'Assoc. not WinAssoc as typed.
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.
Do you have the QT 4.6 or higher libraries installed?
When you run from the console are there any errors listed?
Glad you like WineAssoc, you are of course correct that I should write to the /tmp dir. At the moment it’s just a quick project, if there’s enough interest I’ll 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?
The links appear to be dead, any chance of re-uploading WineAssoc?
The files should be accessible now. Was an issue from a change of server. Thanks for letting me know.
Demanche January 14th, 2013 at 04:21
Hey there, yeah, I know, takes for ever for me to reply.
I am currently running QT 4.8.2
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 ‘can’t connect to X server’.
Leave a reply