Years later, I've made a small utility that scans MIME database (both system and user) and register all known native mime-types in Windows registry.
It uses xdg-open
to open a file if there is a default (native) application for that
mime type, otherwise uses packagekit
to search for a package that can handle
that file (just like what Nautilus does). So my initial requirement of registering only extensions that have an installed, native application was not needed anymore. However, an early version of the script did filter only such types. The snippet that made it possible was:
perl -e '
use strict; use warnings;
use File::MimeInfo::Magic; use File::MimeInfo::Applications;
while (my $line = <STDIN>) {
chomp($line);
my ($ext, $mime) = (split/\t/, $line);
my ($def, @apps) = mime_applications_all($mime);
print "$line\n" if ($def || @apps)
}'
By default my script only registers native types that have no handler in windows
registry, but it can also override such associations (so, for example, jpeg
files are opened in native viewer instead of the default Gecko wine browser).
It can also ignore some extensions even if they have no handler in windows.
It tries its best to be winemenubuilder-friendly, meaning all associations it
creates is not published as native associations (or as x-wine-extension
mimetypes) by winemenubuilder, which would be ugly and potentially cause loops.
This is very tricky and not yet perfect, specially with mixed-case extensions
(.C and .c for example)
That said, I hope this script is helful for everyone:
https://github.com/MestreLion/wine-tools/blob/master/wine-import-extensions
Improvements welcome!
Found blog entries about the same problem for Foxit reader and for PDF-XChange Viewer. None of them worked for me. So I edited them and got one tailored for my case:
#!/bin/bash
Filename="z:${1//\//\\}"
wine "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe" $Filename
Save this bash script and open pdf using this script. Now double click pdf files will open them using PDF-XChange Viewer.
Best Answer
All you need to associate file of some type to be handled by some app, also by wine app, you can find in folder
you will need to open
and find needed type, like this:
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
the whole point in the "Exec=" line at the and "z:%f"
if you don't have this line you should have an error
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"