2

I have a script working from a thumbdrive. It works fine when double clicked or launched with sh filename.sh. I made a .desktop file to launch it from the launcher and put it in both ~/.local/applications and /usr/share/applications.

The desktop file works if i click it from a filemanager(thunar) but not from nemo or nautilus. I ran the desktop file authenticator on it and passed.

If I run the script and right click the icon while in the launcher and select "keep in launcher" it closes when the script closes. also, it fails to show up in dash search.

  1. why does nautilus and nemo report "There was an error launching the application" when thunar launches it fine.
  2. why doesn't the .desktop file show up in search and stay in launcher when drug to it.

The script is 750 lines so i wont be posting it here but it shouldnt matter because it runs fine wherever i put it.

3
  • You should know better about making desktop files otherwise, as in your case, it will not appear in dash
    – Alex Jones
    May 15, 2015 at 4:14
  • list down the .desktop file
    – Maythux
    May 15, 2015 at 5:22
  • The path ~/.local/applications is wrong, that's correct: ~/.local/share/applications. And you don't need /usr/share/applications.
    – A.B.
    May 15, 2015 at 9:01

4 Answers 4

2

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.

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!

1

Another reason that can cause the application to not appear in the launcher is if this property is defined:

NoDisplay=true

From the docs

NoDisplay means "this application exists, but don't display it in the menus". This can be useful to e.g. associate this application with MIME types, so that it gets launched from a file manager (or other apps), without having a menu entry for it [...]

If the NoDisplay=true line is present in your .desktop file, delete it in order for the application to show up when searching for it in the Activities (i.e. by pressing the "Super" AKA "Windows" key).

0

To make it run when double in clicked in nautilus:

  1. Open Nautilus.

  2. Open this from the menu bar:

    Edit → Preferences

  3. Select the 'Behavior' tab.

  4. Select "Ask each time" under "Executable Text Files".

  5. Close the window.

Now you can double-click your executable text file in Nautilus to be asked whether to execute or edit your script.

enter image description here

Similarly for Nemo: Nemo --> Edit --> Preferences --> Behaviour --> Executable Text Files --> "Run executable text files when they are opened"


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .