Application in the Dock can't be added to favourites

I've created .desktop file in ~/.local/share/applications for an application. Now I'm able to find it through Super key. But after executing the application, I can't pin it to the dock using right click -> Add to favorites. Any idea why?


An icon that you find using the Super key can be pinned by right-clicking on it in the Application overview.

An icon of a running application cannot be pinned if it does not have a matching . desktop launcher.

Try pinning the icon you find using Super. Then run the application. If now, you see a second icon in the dock (one that can not be pinned), then your will need to add a StartupWMClass= line to indicate the actual WMClass of the application.

To determine the WMClass of your running application, use the tool xprop. If you are running standard Ubuntu on Wayland, you can determine the WMClass in the "Looking Glass, "Windows" tab. Open the looking glass by typing lg in the Alt+F2 dialog.