Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have my custom script in Ruby with read permission, which starts with:

#!/usr/bin/env ruby

I can run that script from the terminal by typing that path. I added a file with .desktop extention to /usr/share/applications with content

[Desktop Entry]
Name=Foo
Comment=Foo
Exec=/path/to/the/script
Terminal=false
Type=Application
Categories=Utility;Application;

and permission 777. When I open the Ubuntu file/application searcher at the top-left corner, I find my script by typing in the name. But when I click on it, it does not run. What am I doing wrong?

share|improve this question
    
You may believe the content is appropriate but there is no way we can know unless you show us. You should also mention the permissions of the .desktop file. –  terdon Apr 9 at 14:49
    
I added that information, but I don't think the problem is with that part because I had the same problem with adding a launcher to the menu bar with an older Ubuntu, which I asked on this site about , about an year ago: askubuntu.com/questions/329232/…, and it has not yet been solved. –  sawa Apr 9 at 14:55

1 Answer 1

I do not know what exactly is "content that I believe is appropriate". However, if you can run the script through terminal all you have to do is create a script with:

#!/bin/bash    
cd /path/to/folder
command-you-would-run-in-terminal

Make the script executable. Then in your .desktop file, launch the script instead of your command directly.

Example

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Terminal=false
Exec=path/to/icon/bash script
Name=Script name
path/to/icon/here
Comment=A description here
share|improve this answer
    
The script cannot be Ruby but has to be bash? –  sawa Apr 9 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.