Ubuntu Technical
Ubuntu technical problems and solutions reference, a modern cookbook.
Add new application to Open With Other Application…
Posted by on February 1, 2012
What if you want to add a new application in the “Open With Other Application…” section? Maybe you want to add that particular application as the default application to open certain type of files.
Here is an example of how I can add Vim as an option to open a text file. Vim will open the file in a new terminal session.
An .desktop file needs to be created in ~/.local/share/applications
So, let’s use vim for this purpose, it is just appropriate.
vim ~/.local/share/applications/vim.desktop
Press i to enter in edit mode and type in the following:
[Desktop Entry] Categories=; Comment=Edit file in Vim Exec=vim %f GenericName=Process Viewer Hidden=false Icon=vim Name=Vim Terminal=true Type=Application Version=1.0
after that, press ESC to exit the edit mode and type :wq to write to the file and quit.
That’s it. Now when you right click on a file, vim will be present in the list of Open With Other Application section, and you can add it as a default application.
Thanks for this answer to Marty Fried
Advertisements


Thank you for the post above, (The post below applies to Ubuntu 12.04)
I tried this method – however I came across the fact that many programs install their own .desktop file
For instance, pymol (a molecular visualization program) – along with many others such as jedit (a text editor) install their .desktop file in
/usr/share/applications
/usr/share/jedit.desktop – for instance
I then found out that there is a file ~./local/share/applications/mimeapps.list
vim ~./local/share/applications/mimeapps.list (To edit this file)
My file looked like this
———————————————————————————-
[Default Applications]
text/html=google-chrome.desktop
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop
x-scheme-handler/about=google-chrome.desktop
x-scheme-handler/unknown=google-chrome.desktop
x-scheme-handler/mailto=thunderbird.desktop
[Added Associations]
text/x-python=ubuntu-software-center.desktop;
x-scheme-handler/mailto=thunderbird.desktop;
application/x-aportisdoc=pymol.desktop;jedit.desktop
[Removed Associations]
application/x-aportisdoc=nautilus-folder-handler.desktop;
———————————————————————————–
Since pymol reads .pdb files (which are of type application/x-aportisdoc)
I added the line
application/x-aportisdoc = pymol.desktop;jedit.desktop (The first .desktop file being the default)
Similarly, text/html files read the google-chrome.desktop file
Hope this helps,
Pingback: Add new application to Open With Other Application… | Ubuntu Technical « willygroup's blog