When a program is installed, it can copy a file programname.desktop into /usr/share/applications. This suffices to get a launcher in the desktop panel and desktop menu regardless of the window manager (Xfce, GNOME or KDE).
The specification of the .desktop file is a FreeDesktop standard.
Modern desktop environments allow you to use alternative configuration sets (or combine different configuration sets).
One problem is that each of the desktop environments, and freedesktop each use a different way to activate/deactivate these configuration sets.
the desktop-profiles package solves this, by providing a common way to control the activation/deactivation of such configuration sets.
This still leaves the problem of the actual creation of such configuration sets, but making it easy for different ideas of what should be default to co-exist, and compete for market-share.