Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I actually want to ask two questions:

  1. Where can I find more about available arguments/parameters shortcuts for Exec entry in desktop files (like %U, %u, %f...)

  2. 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

share|improve this question
    
What are you trying to do btw? Can you add an example? –  Bruno Pereira Dec 10 '11 at 22:10
    
Hey Bruno ;) I thought it is clear - I made desktop file (purpose - launcher) for wine application and I want to be able to pass file on it. Above z:%f workaround is no good as whenever I launch this wine application argument z: is passed on it and I want to avoid that –  zetah Dec 10 '11 at 22:18
    
So you have a windows program called (ie) application.exe that you want to pass the current selected file in nautilus to it ie file.txt? –  Bruno Pereira Dec 10 '11 at 22:32
    
Sorry I should have added example in my first post. I added it now –  zetah Dec 10 '11 at 22:39
    
I have been having a look around this till now and the only other option for this is a script placed in the exec line that checks for a %f, if it exists launch the application on the file, if not just launch the application. Care for it or is it not an option? –  Bruno Pereira Dec 11 '11 at 1:03

3 Answers 3

This is best I can so far (Notepad example)

[Desktop Entry]
Name=Notepad
Exec=sh -c "echo %f | sed 's/^\//z:\//' | xargs wine /home/zetah/.wine/drive_c/windows/notepad.exe"
Type=Application
Terminal=false
Categories=Wine
MimeType=text/plain

I expect better answers considering I'm beginner

share|improve this answer

For the first question, you can take a look at the Desktop Entry Specification - The Exec key

share|improve this answer
    
Thanks, I found it already: forums.debian.net/viewtopic.php?f=10&t=73512 –  zetah Dec 11 '11 at 12:21

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.

[Desktop Entry]
Version=1.0
Name=Ansys User Lic Prefs 12.1
GenericName=Ansys User Lic Prefs 12.1
Comment=Ansys User License Prefs 12.1
Encoding=UTF-8
Exec=anslic_admin \"\-userprefs121\"
Icon=ansysLogo_16x16.png
Terminal=false
Type=Application
Categories=Ansys;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.