I'm pretty new to Ubuntu so please forgive my ignorance. I've successfully installed Sublime Text 3, Matlab, Arduino IDE, Spider, and Eagle Autodesk. If I open the application and open a file then everything loads just fine. But if I go into Files, locate the desired file (like a HelloWorld.py), and right click "Open with" I am unable to select Sublime Text (or Spider). My only options are gedit and LibreOffice. Selecting "Other Application..." and "View All Applications" still doesn't allow me to select Sublime Text or Spider (they don't appear at all). I have the same issue with .m Matlab files, etc.. How can I get these applications as available options? I'm not sure where these applications are located. I used 'type matlab' to locate Matlab but I haven't been able to use that method to locate any other applications. I'd greatly appreciate help with this issue.
I had this problem and found the answer here: https://ubuntugenius.wordpress.com/2012/06/18/ubuntu-fix-add-program-to-list-of-applications-in-open-with-when-right-clicking-files-in-nautilus/ and http://www.walkingrandomly.com/?p=300 .
Summary: There should be a matlab.desktop file which tells Ubuntu how to handle opening the application. It should be in either
The fix is to add
-r "edit %f" to the end of the "Exec" line in that file.
Mine looked like this
$ cat /usr/share/applications/matlab.desktop [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=matlab -desktop Name=MATLAB Icon=/usr/share/icons/hicolor/48x48/apps/matlab.png Categories=Development;Math;Science Comment=Scientific computing environment StartupNotify=true StartupWMClass=com-mathworks-util-PostVMInit
I just changed that file only in the Exec line to say
Exec=matlab -desktop -r "edit %f"
and it immediately appeared in the "Open With" menu.
For some reason, unlike other applications where you can just add "%f" to the end of the Exec line, MATLAB doesn't actually open that file to edit without specifically saying "run the command
edit %f", which then edits the file you are right clicking to open.
https://ubuntuforums.org/showthread.php?t=794255 This explains with the extra
%f means, as does What does “%U” mean when calling a command? this answer.
It basically just tells
matlab to pass whatever you are right clicking to open as an argument to the