Hi,
For the past few days I have been looking at MIME handling in Wine. A program I'm using uses CreateProcess to launch a pdf file and I would like to use the default native pdf viewer.
Initially I wrote a simple script which calls xdg-open to launch the file offered by Wine. (xdg-open "`wine winepath -u "$1"`") The script works properly and it could be used for all sorts of file formats. It would be useful to have a 'winemime' mechanism for this in Wine (either a script, program or shell32 code).
The issue could be solved in different ways. For instance there is already some XDG MIME code in shell32 which could be extended, a winebrowser-like winelib program could be written or we could use a script. Personally I would favor either of the last two solutions. The main downside of a script is that as far as I know I need to set the whole linux path (e.g. /usr/local/bin/winemime) in the registry and this could be avoided if the tool was a winelib program as it would be in the wine path by default. Second I would like not to depend on the xds-open script on linux but have this code merged inside winemime.
A winelib based winemime would be very similar to winebrowser, so if we would go the winelib way might it make sense to extend winebrowser for this?
I hope to get some feedback and suggestions on how to proceed before I start writing code.
Thanks, Roderick Colenbrander
On Tue, Jun 16, 2009 at 5:26 AM, Roderick Colenbrander < thunderbird2k@gmail.com> wrote:
For the past few days I have been looking at MIME handling in Wine. A program I'm using uses CreateProcess to launch a pdf file and I would like to use the default native pdf viewer.
I think it would be useful to have two different checkbox option in winecfg that ask:
1. "Always open files with native application if available?" 2. "Ask me whether to open with file formats with a native application or my Windows application?"
(Optionally, saying "No" to #1 could imply #2. However, I think it might be clearer to explicitly have it as an option.)
For instance, in the case of PDF's, say you have a great native viewer available and you want to use that viewer to view all PDF's. However, you also have Adobe Acrobat installed under Wine (hypothetical, I have no idea if that app works) and that's what you like to use for editing. You probably want to use the viewer most of the time, but every once in a while you'd probably like to be prompted to use Acrobat so you can edit the PDF.
What would also be slick is to have the Windows Explorer "Open With..." functionality provide a list of native apps as well.
-Brian
On Tue, Jun 16, 2009 at 7:23 PM, Brian Vincentbrian.vincent@gmail.com wrote:
On Tue, Jun 16, 2009 at 5:26 AM, Roderick Colenbrander thunderbird2k@gmail.com wrote:
For the past few days I have been looking at MIME handling in Wine. A program I'm using uses CreateProcess to launch a pdf file and I would like to use the default native pdf viewer.
I think it would be useful to have two different checkbox option in winecfg that ask:
1. "Always open files with native application if available?" 2. "Ask me whether to open with file formats with a native application or my Windows application?"
(Optionally, saying "No" to #1 could imply #2. However, I think it might be clearer to explicitly have it as an option.)
For instance, in the case of PDF's, say you have a great native viewer available and you want to use that viewer to view all PDF's. However, you also have Adobe Acrobat installed under Wine (hypothetical, I have no idea if that app works) and that's what you like to use for editing. You probably want to use the viewer most of the time, but every once in a while you'd probably like to be prompted to use Acrobat so you can edit the PDF.
What would also be slick is to have the Windows Explorer "Open With..." functionality provide a list of native apps as well.
-Brian
The XDG spec which is what I would use defines how to find a program which can handle the format (a default handler). The user can override the handler but I'm not sure whether the spec also defines a way to query which programs can handle the format. This would be needed for the 'Open With...' stuff if it is possible then it should be done from within shell32.
What I'm interested in at this point is a method to add native apps to handle opening of files (using HKEY_CLASSES_ROOT like on Windows). I propose to do this using a winemime program/script. The tool would use 'xdg-open' to get the default handler (when the user selects a different handler from the default handler on the system, his preference is selected). I'm not sure whether the tool needs to be a script, program or whether it should be part of shell32. If it is a script should xdg-open be forked or ported to C for a winelib version of winemime?
Roderick
Just for the record winebrowser already seems to support what is needed without any changes, so need for winemime. The following does the trick for pdf: REGEDIT4
[HKEY_CLASSES_ROOT.pdf]
@="pdffile"
"Content Type"="application/pdf"
[HKEY_CLASSES_ROOT\pdffile]
[HKEY_CLASSES_ROOT\pdffile\shell]
[HKEY_CLASSES_ROOT\pdffile\shell\open]
[HKEY_CLASSES_ROOT\pdffile\shell\open\command]
@="winebrowser "%1""
Roderick
On Tue, Jun 16, 2009 at 8:13 PM, Roderick Colenbranderthunderbird2k@gmail.com wrote:
On Tue, Jun 16, 2009 at 7:23 PM, Brian Vincentbrian.vincent@gmail.com wrote:
On Tue, Jun 16, 2009 at 5:26 AM, Roderick Colenbrander thunderbird2k@gmail.com wrote:
For the past few days I have been looking at MIME handling in Wine. A program I'm using uses CreateProcess to launch a pdf file and I would like to use the default native pdf viewer.
I think it would be useful to have two different checkbox option in winecfg that ask:
1. "Always open files with native application if available?" 2. "Ask me whether to open with file formats with a native application or my Windows application?"
(Optionally, saying "No" to #1 could imply #2. However, I think it might be clearer to explicitly have it as an option.)
For instance, in the case of PDF's, say you have a great native viewer available and you want to use that viewer to view all PDF's. However, you also have Adobe Acrobat installed under Wine (hypothetical, I have no idea if that app works) and that's what you like to use for editing. You probably want to use the viewer most of the time, but every once in a while you'd probably like to be prompted to use Acrobat so you can edit the PDF.
What would also be slick is to have the Windows Explorer "Open With..." functionality provide a list of native apps as well.
-Brian
The XDG spec which is what I would use defines how to find a program which can handle the format (a default handler). The user can override the handler but I'm not sure whether the spec also defines a way to query which programs can handle the format. This would be needed for the 'Open With...' stuff if it is possible then it should be done from within shell32.
What I'm interested in at this point is a method to add native apps to handle opening of files (using HKEY_CLASSES_ROOT like on Windows). I propose to do this using a winemime program/script. The tool would use 'xdg-open' to get the default handler (when the user selects a different handler from the default handler on the system, his preference is selected). I'm not sure whether the tool needs to be a script, program or whether it should be part of shell32. If it is a script should xdg-open be forked or ported to C for a winelib version of winemime?
Roderick