How to associate a file type within Wine with a native application?

6,141

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.

Share:
6,141

Related videos on Youtube

UAdapter
Author by

UAdapter

Updated on September 17, 2022

Comments

  • UAdapter
    UAdapter over 1 year

    For example, I want all avi files to be associated with mplayer in Wine

    mplayer /home/user/myvideo.avi
    

    Edit from Oli: I believe this this actually the inverse of what most people would assume from the original title. Unless I'm mistaken the user is using Total Commander in Wine and would like to launch a Linux-native player on the path. If I'm wrong, just rollback this edit.

  • MestreLion
    MestreLion almost 13 years
    ... or use @="c:\windows\system32\winebrowser.exe \"%1\"" as the command. Its a wine builtin that translates the path and launches the file using xdg-open. So, provided that mplayer is already configured outside wine to handle avi files, its a more generic solution (and no scripting or sudo needed)