How to Fix Linux Menu Icons for Portable Electron Apps
You downloaded a Linux app as a portable folder or a raw binary — Antigravity IDE, a portable VS Code, a side-loaded Electron tool. You wrote a .desktop file, dropped it in ~/.local/share/applications/, and the app is gone from the menu. The launcher grid shows nothing. The search box finds nothing. You open the .desktop file and the Icon= line points at a perfectly valid PNG, yet the system acts like the icon does not exist.
The problem is almost never the icon file. The problem is whitespace in the path.
GNOME, KDE, and most freedesktop-compliant desktop environments parse .desktop files with a config parser that is unusually strict about spaces. A path like /home/ubuntu/Downloads/Antigravity IDE/resources/app/resources/linux/code.png will silently fail to load for two reasons: the unquoted space inside Icon= breaks the parser, and even when the parser survives, the desktop file validator (which runs when update-desktop-database regenerates the cache) treats the entry as malformed and drops it.
I burned an hour on this the first time. The second time I wrote the fix down. This is the four-step version that survives every Electron portable app I have thrown at it.