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:
Well, it must be in Other Applications, I said to myself. I was wrong. It was not in the list of recommended applications:
I was very hopeful of finding it in Show other applications. But that too turned out futile.
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:
If you have something like this, replace this line with:
Save it and exit/close the desktop file. No need to restart or anything. It should be working instantly.
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.