How To Add An Application In The List Of Open With Applications In Ubuntu 13.10

What happens when you don’t find your favourite application in the list of ‘open with’ applications? Ever thought how to add an application in the list of open with applications in the right click menu?

A lot of my how to articles include screenshots. While I use Gimp for resizing and compressing the image, I prefer to use Pinta for adding text and circles to the images. Its a light and easy to use app. In Ubuntu, when I tried to open an image with Pinta by right clicking on it, I simply did not find it there:

 Add an application in the list of right click option in Ubuntu

Well, it must be in Other Applications, I said to myself. I was wrong. It was not in the list of recommended applications:

Add an application in the list of right click option in Ubuntu

I was very hopeful of finding it in Show other applications. But that too turned out futile.

Add an application in the list of right click option in Ubuntu

Now, if you bear this much with me, I am going to show you the trick that you can use to add any application in the list of open with applications in Ubuntu or any other Linux OS.

How to add any application in open with list:

this tutorial is demonstrated with Pinta image editor. You can use the similar steps for any program. Just change the Pinta with your application names in the commands we are going to use.

To add any program in the list of default list of open with applications, open a terminal and use the following command:

sudo gedit /usr/share/applications/XXX.desktop

Please note two things. In XXX.desktop, XXX is the name of your application. And then use of gedit. You can use any other editor. I used Vim. If you use Gedit, it will dispaly some warning messages in the terminal but will open the file in a GUI.

In this desktop file, look for a line that looks like this:

Exec=XXX

If you have something like this, replace this line with:

Exec=XXX %F

Add an application in the list of right click option in Ubuntu

Save it and exit/close the desktop file. No need to restart or anything. It should be working instantly.

Add an application in the list of right click option in Ubuntu

Explanation

Now to explain what does this %F means. %F is actually an Exec Key. It means the program will be supplied with multiple file inputs at the same time (arguments). So if I have this %F set in Pinta, I can open multiple images in same instance of Pinta (think it like tabs in a web browser). But the program must support this feature.

The question which you might be wondering about is why was it not showing in the list of applications before and why after adding %F, it is working. The reason is that when there is no such Exec Key, the program will not accept any argument which means, you can not “open with” a file with this application as “open with” supplies the file as the argument.

You can read more about Exec Key here.

I hope the tutorial helped you to add applications in the right click option of open with applications in Ubuntu. Any questions or suggestions are always welcomed.

  • Christopher Mason

    Thanks! Was trying to figure this out. This helped a lot!

    • http://www.computerandyou.net/ Abhishek Prakash

      Welcome Christopher

  • Liketh

    would it be possible to write a script or a program that will automatically apply this process to multiple programs at once? how about a script or program that will ask you if you want to apply this solution for any program prior, during, or right after installation &/or updates?

    • http://www.computerandyou.net/ Abhishek Prakash

      It could be a nice idea BUT it will depend upon the ability of application to handle file in argument. Moreover, it should be the application developers who should be taking care of this, IMO.
      But yes, it could be an idea. May be if I have time, I could try making one. Can’t promise though ;)

  • IOFeed

    Thanks, this helped.