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.

Some programs can only be run from within their own directories. If I go to System --> Preferences --> Main Menu --> Add Item and select the file, it will not work. Similarly, if I right click on the Panel and choose "Add to Panel...", choose "Custom Application Launcher," and then point to the file, it will similarly fail. How can I add a launcher to my panel and an entry in my Main Menu that will successfully launch this kind of program?

share|improve this question
add comment

3 Answers

Have you tried using a script to launch the app instead?

Something like:

#!/bin/bash
cd /my/dir
myprogram

Select the script instead of the file.

share|improve this answer
add comment
up vote 3 down vote accepted

So what I did is this:

I created a plain text file and wrote the following bash script for a Latin translation program I use, called Words:

#! /bin/bash

cd ~/latin/latin.words/

./words

After saving it in my home folder, I made it executable, which can be done in one of two ways. I right clicked on it, choose Properties->Permissions, and check the "Execute" box for your user name. Or I could have used the command line and entered chmod +x file.name .

Then I right clicked on the panel and chose "Add to Panel...", select "Custom Application Launcher." I entered the name, in this case "Words," and the path to the script I just wrote in the "Command" field. Because Words is a command line program, I selected "Program in Terminal" from the drop-down menu. I then clicked on the icon and selected an appropriate one and with that I was done adding it to the panel.

Next I clicked System->Preferences->Main Menu, selected the folder I wanted to put the menu launcher into, and then clicked "Add Item." I then repeated the process I just performed, above.

And now I have a custom launcher that works for a program that must be run from its own directory, both on my panel and in the menu!

share|improve this answer
add comment

cd /path/to/dir/ && gksudo bin_file

That should do the trick.

share|improve this answer
add comment

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.