2013/08/23

Nautilus File Manager: Add An Application to "Open With" menu in Ubuntu Linux 13.04

I found myself needing to open .mp3 and .ogg files with an application (pyRenamer) from within the file manager nautilus, also called Files, in Ubuntu Linux 13.04. From within Files, you can right click on a file and a menu opens, then select "Open With" and the application you want the file to open in.
My problem was "pyRenamer" was not listed in the applications and so this post gives instructions on how to add an application to the "Open With" menu in the Files application.

I used information from this site: https://ubuntugenius.wordpress.com/2012/06/18/ubuntu-fix-add-program-to-list-of-applications-in-open-with-when-right-clicking-files-in-nautilus/

1. Find the name of the application you want to open. It is probably found in /usr/share/applications. You can list all the applications in this directory with
ls /usr/share/applications
The name of the application will end in ".desktop", for example pyRenamer.desktop.

2. Edit pyrenamer.desktop file. This method affects all users of the machine.
sudo gedit /usr/share/applications/pyrenamer.desktop
edit the line: Exec=pyrenamer
to: Exec=pyrenamer %F
Save file and exit.
This allows you to select pyRenamer application from within the right click menu:Open With/Other Application... 

3. This is an alternate method of adding an application to the right click "open with" menu. This method is user specific.
Open the file /home/$USER/.local/share/applications/mimeapps.list in your favorite text editor. $USER will be your user name and does not need to be changed if you paste this into the command line.
gedit /home/$USER/.local/share/applications/mimeapps.list

4. Edit this file so that .ogg and .mp3 files can be opened by pyRenamer application. There are two highlighted lines that I added.

 
Hope this helps!