I actually want to ask two questions:
Where can I find more about available arguments/parameters shortcuts for Exec entry in desktop files (like %U, %u, %f...)
Main question, how to pass file as argument on .desktop launcher for wine application?
I found searching here this suggestion: z:%f
which is of no use to me, as if I simply run .desktop file without passing file on it, it assumes that argument is z:
and starts scanning z:
"drive"
Example:
[Desktop Entry]
Name=Some Windows program
Exec=wine "program.exe" z:%f
Type=Application
Terminal=false
MimeType=application/docbook+xml
I want to drop XML file on my custom .desktop launcher for this wine application and I can this way. Problem is that if I click on launcher icon to evoke this program, argument z:
is always passed on it and that's not acceptable
This is best I can so far (Notepad example)
I expect better answers considering I'm beginner
For the first question, you can take a look at the Desktop Entry Specification - The
Exec
keyAn improvement on zetah's answer. This works for passing multiple files to the program. The %f is changed to %F (upper case) to pass all the files dropped, replacing the ^ (for the beginning of the line) with enough of the path name to make it more likely unique, the 'g' at the end of the sed command to cause the replacement to repeat for all files passed and finally the $ instead of the / so that the \ escape characters are not necessary.
I also moved the program to be executed to a path where the pathname has no spaces, so I moved my boxer editor from:
to:
There were lots of hackish solutions posted in this thread. Here's a much better solution that deals with multiple files and with spaces in filenames.
Create the .desktop file as you usually do, and simply use this Exec line:
Edit: If your application can handle multiple files in a single instance (for example a multi-tabbed PDF viewer) and you want the current instance to be auto-focused whenever you launch a new file then you need to do the following:
Add this line to the .desktop file:
StartupWMClass=app.exe
Use this Exec command:
An Exec line with a pipe of winepath to xargs, used with proper quoting and their -0 options, works flawlessly in Ubuntu 14.04 for opening single and multiple files.
This is the way that just worked for me on a RHEL 6.3 box after some trial and error and reading the Desktop Entry Specification. It's not specific to wine with arguments but it should work with something like
Exec=wine \"filename.exe\"
.Hope it helps someone as it took me some searching to get it to work.
I think you have to use double quotes and escape them as well as any special characters using a backslash.
I just wrote a tiny Python script which converts Unix-style paths into Wine path format.
Download the zip, extract wine-launcher.py into your home folder and edit your .desktop file like this: