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.
Best Answer
Ok, this is quite simple, what you want to create is a named file with a
.desktop
extension with contents like this:To create this file globally you can run your favorite text editor as root using
sudo
, using the terminal application. If it's a graphical editor, keep your environment clean by adding the-H
flag:Browse to the
/usr/share/applications/
directory. It should look something like this:Select any
.desktop
file, it should look something like thesteam.desktop
example above. After you have edited it it should be close to this:It is important to note that the path to the files has to be the full path. Tilde expansion won't work so you can use
~/
paths. Also if you want to run your script as root you can addgksudo
(gksudo
has been removed from ubuntu as of 13.04, you can install it by running the commandsudo apt-get install gksu
in the terminal) before the sh command on theExec=
line.Once you have saved your file, right click, go into properties, permissions and make sure that Allow executing as file is ticked. Then restart, it may not be required though.
Terminal way:
or
Edit it then save as what you want to call it.
You may need to restart you pc