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