When launching an application from a custom .desktop file, it may result in a duplicated icon showing up in the Gnume's dash or Ubuntu's unity launcher panels. To avoid this problem, we may specify the window class in the launcher .desktop file, we can do this by opening it with gedit.
The Window class of a program can be obtained by typing xprop WM_CLASS in a terminal, then selecting the main window of the program by clicking on it, the window class will then be written out in the terminal, and then we can simply copy and paste it into the launcher.
Note. If the window is not visible simply press alt + tap until it is in focus.
You will need to open the .desktop file in a text editor, and add the following line:
Note. The [Name_of_Window_Class] part should be replaced with the output of the xprop command.
When done, restart the application, and there should now only be one icon visible in dash.
Where to find application launchers
Possible locations for custom launchers are: