This info isn't easy to find on the internet, so I decided to share the solution here for those who don't know it and have come across the same problem. It's about desktop environments that use programs from other environments, which was my case - I'm using Cinnamon with a few programs from KDE. And in my case when clicking "open with... Kolourpaint", it used to start as a second instance of the same program which was unacceptable.
So, the solution is simple: open .local/share/applications and find the .desktop file for your program. If it's not there, copy it from usr/share/applications. The .desktop files in .local/share/applications take priority over those in /usr and the system will read them first and will ignore those in /usr.
Then open it with any text editor (such as gedit) and at the end of the file add
Here's an example:
After that it's a good idea to make a backup of this file, in case you ever need to reinstall your distro, so that you don't have to do this exercise all over again.
IDK what causes the programs to behave like this but this is the only workaround I was able to find.
So, the solution is simple: open .local/share/applications and find the .desktop file for your program. If it's not there, copy it from usr/share/applications. The .desktop files in .local/share/applications take priority over those in /usr and the system will read them first and will ignore those in /usr.
Then open it with any text editor (such as gedit) and at the end of the file add
Code:
StartupWMClass=[your-program-name]
Here's an example:
Code:
StartupWMClass=kolourpaint
After that it's a good idea to make a backup of this file, in case you ever need to reinstall your distro, so that you don't have to do this exercise all over again.
IDK what causes the programs to behave like this but this is the only workaround I was able to find.