5

I've looked at some other StackExchange questions pertaining to this topic, but for whatever reason I still cannot get to a resolution.

This is the simple test.desktop file I have on my desktop:

[Desktop Entry]
Version=1.0
Name=Test        
Comment=Test the terminal running a command inside it
Exec=gnome-terminal -e "~/test.rb"
Icon=utilities-terminal
Terminal=false
Type=Application
Categories=Application;

I am simply trying to make a shortcut that runs a Ruby script when double clicked. I'm trying to make this extremely easy for an end-user to open up, but it just keeps opening up in a text editor when I double click the file.

I have also verified that it has write permissions as well, but still nothing. If I replace ~/test.rb with ifconfig, it still doesn't work.

What am I doing wrong here?

1 Answer 1

4

To do this correctly in the Gnome Shell desktop environment (i.e., the desktop environment of standard Ubuntu), place your .desktop file in either .local/share/applications or in /usr/share/applications. That way, the laucher will appear in the Applications Overview, and can, if desired, be pinned to the Dock/Dash for easy access.

.desktop files in the first mentionned directory will be available for the current user only. Place them in /usr/share/applications (of course, only a user with root permissions can do that) for system wide access.

Alternatively, to run the launcher from the desktop, you need to make it executable and mark it as trusted. I am not sure whether that still works in Ubuntu 19.10, where a Gnome-shell extension is used to provide desktop icons instead of the file manager providing these.

4
  • The user that I am setting this up for will be using the same account that I'm logged in as. I'm looking for a solution that allows them to just double click on an icon on the desktop to start a script. Commented Nov 23, 2019 at 15:55
  • Then there is your solution: put it in .local/share/applications and pin it to the dock.
    – vanadium
    Commented Nov 23, 2019 at 15:57
  • Thanks. I'm not sure how to place it in the dock after moving it to /usr/share/applications I've opened up the folder from nautilus and cannot drag and drop anything in there to the dock. I've right clicked and also don't see anything in the context menu for placing anything in the dock. Any suggestions on that by chance? Commented Nov 23, 2019 at 15:59
  • 2
    As usual. Right-click the launcher in the Applications Overview, and select "Add to Favourites". You can do also from the icon on the dock when the application is running.
    – vanadium
    Commented Nov 23, 2019 at 16:02

You must log in to answer this question.

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