0

I have some scripts in /home/thierry/bin/ that I want to be able to find and run through the search bar.

I have tried to create a .desktop file: I can find it in the search, but when I try to start it, it just opens it in a text editor. The file is executable. When I double-click it, it executes the script correctly.

Content of the .desktop file:

[Desktop Entry]
Version=1.0
Exec=/home/thierry/bin/tunnel_db
Name=Tunnel DB
GenericName=Tunnel DB
Comment=Start SSH tunnel to DB
Encoding=UTF-8
Terminal=true
Type=Application
Categories=Application;Network;

I would prefer another method though, so I don't have to do it for every script I have in my bin folder.

How can I simply execute a script from the search bar?
It's ok if I have to move my scripts in a different folder

5
  • " it just opens it in a text editor." Make the script executable (chmod 770) and it should ask if you want to run it or view it
    – Rinzwind
    May 13, 2022 at 13:44
  • The file is executable. When I double-click it, it executes the script correctly. Just not when I launch it from the search bar.
    – Thierry J.
    May 13, 2022 at 13:48
  • @ThierryJ. Please edit your question and add all information or clarification there instead of using comments for this purpose. Copy&paste the contents of the .desktop file and format it as a code block, e.g. by using the {} tool of the editor field.
    – Bodo
    May 13, 2022 at 14:43
  • How do you try to start the desktop file?A desktop file in the proper format and location will appear in your application overview, from where you can launch it.
    – vanadium
    May 16, 2022 at 16:08
  • I try to start it from the search bar, the thing that lets you search for any program on the system that pops up when you press the windows key.
    – Thierry J.
    May 17, 2022 at 6:37

1 Answer 1

0

So what happened was that, when I searched for my exec file through the search bar, the system would find a file corresponding to the name, but was running it through the "Files" application.

As Nautilus in Ubuntu 22.04 doesn't provide an option to execute text files directly (instead you can only execute text files through right click > Run as a program), selecting this entry would only open the launcher file in a text editor.

The solution is to place the launcher file in the applications folder (~/.local/share/applications), it becomes then available as an actual executable through the search bar!

The application menulibre can help create nice launcher files, in the right place.

You must log in to answer this question.

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