7

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
12
  • Could you post the contents of the .desktop file? (and I think you mean the Windows -key?) Sep 20, 2014 at 11:32
  • yeah, right, the windows key.
    – Gokul
    Sep 22, 2014 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, 2014 at 15:55
  • 2
    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 for more information
    – MrVaykadji
    Sep 22, 2014 at 16:31
  • 1
    @MrVaykadji Absolutely, all you say is true, but the Exec line is critical Sep 22, 2014 at 17:36

1 Answer 1

8

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.

1
  • this was a genuinely useful answer. There are a lot of answers on this topic that don't help! The issues I had were that my categories were not ones from the list, and that I referred to /home/user as ~. Apparently it doesn't like that. You have to specify the whole /path/.
    – gannex
    Sep 12, 2023 at 23:17

You must log in to answer this question.

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