Overriding .desktop files on Ubuntu snaps


Is there a recommended approach for overriding the .desktop files that are bundled with snaps? The ‘normal’ way to do this would be to plop a file with the same name in ~/.local/share/applications/. If I try this in Ubuntu 18.04, I end up with two entries in the applications menu.

My reason for wanting to do the above, is so that I can use custom icons for some snaps; perhaps there’s a better way?



I’ll let others comment on if there is a better way, but if you are doing this, be sure that you are copying the file from /var/lib/snapd/desktop/applications so that your Exec line is using the binary from /snap/bin so it is properly launched under confinement.

1 Like

That seems to do the trick for me - cheers!

The .desktop files are indeed located in /var/lib/snapd/desktop. And their names are in the following format: snap-package-name_original-name.desktop. This explains why overrides with original-name.desktop in ~/.local/share/applications/ did not work. When renamed to snap-package-name_original-name.desktop things work perfectly!

1 Like

You can find all directories with desktop files in the XDG_DATA_DIRS environment variable. The *.desktop files can be in the applications directory in each of the directory in that variable. E.g.:


From: https://askubuntu.com/a/1348668/2355

I’m not sure how this applies to overriding a .desktop file, though.