How do I add a program that must be run from within its own directory to the panel or main menu?
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?
Solution 1:
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.
Solution 2:
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!
Solution 3:
cd /path/to/dir/ && gksudo bin_file
That should do the trick.