getting .desktop file to show up in launcher

Solution 1:

Try using Arronax. It's a .desktop file editor that works well. You can create .desktop files for binary/script files, or .desktop files that run a command. You can also set the icon for the .desktop file.

Solution 2:

I might be late (as you posted in may), but this is what I figured out. I am also sorry for how much I drag this on, but I am trying to get into detail, for anyone else who has this problem and would like help.

I found that if you want to search it, you have to add a line in the .desktop file. Here is my .desktop file.

You do not have to do this section, but I recommend it:

For my icon and exec lines, I made a folder in my Home directory called "Applications" that I put all my .jar, .sh, etc. files. You can just replace the line with whatever the location for your file is.

You can also make a folder for your icons. I didn't, but it would help ;). Again, if in another directory, just replace the line with whatever the location for your file is.

Also VERY IMPORTANT for the directories. When I made my .desktop file, I forgot to put quotes around the directory to my file. It wouldn't run without it, but I fixed it. This may be the problem. If that is the case, here is an example with and without. I will be using Feed The Beast as an example. If it is the icon that is the problem (eg. not showing), replace Exec= with Icon=. If you are trying to work on a jar file, at the beginning, put java -jar. You need Java to open them. To check if you have it, open a terminal and type java --version.

Not Working:

Exec=/home/e1337gamerman/Applications/Feed The Beast/FTB_Launcher.jar

Working:

Exec="/home/e1337gamerman/Applications/Feed The Beast/FTB_Launcher.jar"

Jar:

Exec=java -jar "/home/e1337gamerman/Applications/Feed The Beast/FTB_Launcher.jar"

I will replace my lines to go along with a .sh file, and I will call it "Bash.sh". For the Terminal line, put true if you want to open a terminal when started. Otherwise, false. My computers username is e1337gamerman, but replace with yours.

[Desktop Entry]

Type=Application

Name=Bash

Comment=Your comment here

Terminal=false

StartupNotify=true

Exec=/home/e1337gamerman/Applications/Bash/Bash.sh

Icon=/home/e1337gamerman/Applications/Bash/Bash.png

Keywords=bash;

This should fix the problem. Put in the /usr/share/applications/ folder, then restart your computer. It should start working in your unity launcher. If not, wait a few minutes. Then, just search for it.

Keywords should be used like so:

Keywords=blah;blah;blah;

For spaces, you may or may not need quotes. Refer to the Ubuntu help section for that here. Also, multiple need a semicolon, followed by the word without a space. You should close the line by putting a semicolon after the last word.

There you go. This looks complicated, but it really isn't. Hope this helps. Have fun!