6

I've created a .desktop file.

[Desktop Entry]
Exec=cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*
Terminal=false
StartupNotify=true
Categories=GNOME;Oracle;Utility;Development;
Type=Application
Icon=/opt/sqldeveloper/icon.png
Name=Oracle SQL Developer
Comment=what to say
Version=s.0.m.t.h.i.n.g
GenericName=ORACLE SQL DEVELOPER

It is present in /usr/share/applications .It is even showing the icon if viewed in Nautilus, but when I press alt (the dash or windows key) and search for it, it is not visible.

Also I tried:

sudo update-desktop-database
Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Gokul
  • 365
  • 2
  • 5
  • 10
  • Could you post the contents of the .desktop file? (and I think you mean the Windows -key?) – Jacob Vlijm Sep 20 '14 at 11:32
  • yeah, right, the windows key. – Gokul Sep 22 '14 at 15:48
  • Have you (at least) tried relog? The "Version" string is very uncommon - might be an issue. AFAIK the bash commands should be placed between quotation marks. – roomcayz Sep 22 '14 at 15:55
  • There is a number of issues with your command, using it like that in a .desktop file. Change it and it is ok. I tried your file with another (working) command, then it works fine. I'll anwer it when it is reopened. – Jacob Vlijm Sep 22 '14 at 16:06
  • changed version string .still no result. – Gokul Sep 22 '14 at 16:16
  • It's not the version string that causes the error. – Jacob Vlijm Sep 22 '14 at 16:25
  • 1
    1) version should be 2 numbers `1.0` for ex 2) your Exec is wierd, how about `bash /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper $*` ? (not sure that you can use a wildcard like * in your exec line though) 3) GenericName is the same as Name ? There's no point in that... remove GenericName entry if you're gonna use the same string 4) Is the icon valid ? If the icon doesn't exist, it will most likely never be displayed in Dash 5) Oracle isn't a recognized Category, you should read [freedesktop's documentation](http://standards.freedesktop.org/desktop-entry-spec/latest/) for more information – MrVaykadji Sep 22 '14 at 16:31
  • @MrVaykadji Most of what you say is not causing the file to be refused. did you try it? I guess not. – Jacob Vlijm Sep 22 '14 at 16:33
  • @JacobVlijm tried it right now. The error is definitively coming from the `Exec` line. Note that my previous comment is still true regarding freedesktop recommendation :p – MrVaykadji Sep 22 '14 at 16:42
  • Check [this question](http://unix.stackexchange.com/q/156892/41104) so you can know what exactly is wrong. – Braiam Sep 22 '14 at 16:51
  • @MrVaykadji Absolutely, all you say is true, but the Exec line is critical – Jacob Vlijm Sep 22 '14 at 17:36
  • This may be useful:http://askubuntu.com/questions/67753/how-do-i-add-an-application-to-the-dash – Sergiy Kolodyazhnyy Sep 22 '14 at 17:48

1 Answers1

6

What is the critical issue in your .desktop file

I tried your .desktop file replacing the Exec= command with another (simple and working) one and the file appears to be functional, and is not refused by Dash.

It is a common misunderstanding that you can use the Exec= line of a .desktop file as if it were a terminal window. That is not the case; expanding like ~/ or $HOME doesn't work for example. It is good (meaning: easy) practice to place more complicated commands in a separate script file, to be executed from the launcher file (your .desktop file)

Running complicated commands from a .desktop file

If you specifically want to keep your command inside your .desktop file, you should make it as follows:

Exec=sh -c "your_complicated_command_here && the_rest_of_it"
(command inside quotes)

Running a script from the .desktop file to do the job

Assuming that your command

cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*

works from a terminal window, I would however simply create a small script:

#!/bin/bash
cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*

Save it as scriptname.sh, and change the Exec= line of your .desktop file into:

Exec=sh /path/to/scriptname.sh

Then your .desktop file will show up in Dash

Note

That there are more issues with your .desktop file, as mentioned by @Braiam and @MrVaykadji. A few examples:

  • You should not use just use made up values in the Categories= line, as you can read here
  • The version field is not required, but if you use it, use 1.0

More can be found here. Good tools you can find here (also thanks to @Braiam and @MrVaykadji).

The critical one that makes your .desktop file not appear in Dash however is the Exec= line.

Jacob Vlijm
  • 82,471
  • 12
  • 195
  • 299