All you need to associate file of some type to be handled by some app, also by wine app, you can find in folder
~/.local/share/applications
you will need to open
~/.local/share/applications/mimeapps.list
and find needed type, like this:
image/jpeg=eog.desktop;wine-extension-jpeg.desktop;
as you see there are two files which are relative to this type, if the file stand first it will be the default handler for this type, the other will be shown in "Open with" menu
this is example of .desktop file
[Desktop Entry]
Name=PHP Expert Editor
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
MimeType=image/jpeg
Type=Application
StartupNotify=true
Path=/home/m/.wine/dosdevices/c:/Program Files/PHP Expert Editor 4.3
Icon=/home/m/.local/share/icons/10de_phpxedit.0.png
the whole point in the "Exec=" line at the and "z:%f"
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
if you don't have this line you should have an error
Can not open file "/home/...."
while trying to open some file with your app, because of wine paths are like windows disks and to open your file, for example "/home/picture.jpg" in wine you should use path "z:/home/picture.jpg"
The Wine page has some detail on this.
First you need winepath
to translate the path. This will make the script and give it permission to run:
mkdir -p ~/bin/
echo '#!/bin/sh' > ~/bin/run_linx_program
echo '$1 "`wine winepath -u "$2"`"' >> ~/bin/run_linx_program
chmod a+x ~/bin/run_linx_program
Then you'd save something like this to a file called association.reg
:
[HKEY_CLASSES_ROOT\.avi]
@="AVIfile"
"Content Type"="video/x-msvideo"
[HKEY_CLASSES_ROOT\AVIfile\Shell\Open\command]
@="/bin/sh run_linx_program mplayer \"%1\""
Then run regedit association.reg
to add the association to Wine's registry.
Note: this is adapted from the Wine page. I got the mime-type from within Linux (file --mime-type an_avi.avi
). Wine may treat AVI files differently.
Best Answer
Here is how you associate native applications in wine:
From the Wine FAQ
You can associate
winebrowser
with any file types to achieve the result.winebrowser
program usesxdg-open
to find the native application for a file type.You need to create a registry file with these contents to associate
.pdf
files. Save it asimport.reg
file in your home folder.Now import the registry file using this command
This will open pdf files from Wine applications with the native application which is set as default for a pdf file.