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

What happens when you don’t find your favorite 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 here:

 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 an 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.

Similar Posts

  • Thanks. Very useful. Is there a way to make this the default applilcation, so that a file with a given extension will automatically the application when I double-click on the file icon?

  • Does this also work with app images? If not, how would one get a program to open with an app image if the app image does not allow for desktop integration? I was not able to get this to work with an app image using these instructions.

  • Thanks for this post. Indeed I still had to select the program via the ‘show other applications’ the first time. But after that it showed up directly in the open with menu… (I’m on Fedora btw, but I guess this is a gnome thing)