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.

This a specification of my previous question (What's a .desktop file?) where I wondered how to create a .desktop file in order to create an icon on the launcher for a Wine application.

I don't understand what do we have to do with the following code:

[Desktop Entry]
Name=FooBar
Comment=Foo & Bar
Exec=sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER; wine foobar.exe"
Icon=wine
Terminal=false
Type=Application
Categories=Wine;
StartupNotify=true

Replace USER and FOOBAR_FOLDER with appropriate values. So you'll be able to locate your application in the Launcher by typing "FooBar".

This is the top answer given to a question similar to my previous one, which you can see here: How does one create a custom application launcher for Wine installed apps?, but I don't understand how shall I handle the code I just provided. I tried to copy and paste on the terminal, but it wouldn't work.

In other words, I need that same answer but more comprehensively explained and easier to understand since I don't get what to do with the code provided! Please note, I have few skills with computers. Thank you very much! :)

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Desktop files contain a command to open an application. It is not much more than a textfile, with the extension ".desktop". Although you can store these files anywhere, and run it as a standalone link to an application (that is: if you make it executable), the default locations are:

`/usr/share/applications`

(globally) or

`~/.local/share/applications` 

(locally).

What you need to do is paste the text in your post into an empty textfile (open gedit), and change the line:

Exec=sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER; wine foobar.exe"

What do you need to change?

Explanation of the sections of the line:

Exec=

This means: what comes after this will be executed if the desktop file is invoked. That is actually what would make the application start if you would run it in a terminal.

sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER;

this is telling the shell to go into the directory where the application is located (the backslash in /Program\ Files is to escape the space in the name of the Program Files folder, telling the shell not to stop at the space).

You should replace USER with your own username, replace FOOBAR_FOLDER with the name of the application folder. If you don't know, open your home directory, press ctrl+h to make the .wine folder visible (if it isn't already), and browse into the directory ~/.wine/drive_c/Program Files to see the name of your application folder.

wine foobar.exe

This tells the shell to run foobar.exe with Wine. Replace foobar.exe with the actual application_name.exe.

Finally, your Exec= line should look something like (if RedNotebook is your application for example):

Exec=sh -c "cd /home/antortjim/.wine/drive_c/Program\ Files/RedNotebook; wine rednotebook.exe"

Then, after you have changed the line Name=Foobar into a more appropriate name, save the file as (for example) rednotebook.desktop

If you want to use the file as a starter on your Desktop, save it there as renotebook.desktop and make it executable. If you want to run it from Dash, move it into ~/.local/share/applications. After log out and back in, it will be available in Dash. You can lock it to the launcher then.

share|improve this answer
    
Thank you very much for such a comprehensive answer. I understood what a desktop.file is and how to use the code. I also tried it with Foxit Reader on Wine. I created a desktop file that, when double clicked, launches Wine, but before Foxit does, shuts down. Anyway, I found a launcher for Foxit on Wine in the Dash, probably generated on previous trials. But I experience some issues with it, but I think I should leave them for another question. Again, thank you! –  antortjim Apr 22 at 18:44

A .desktop file is a text file. You have to open a text editor, like Gedit and paste the content and save it.

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.