Optimized freedesktop generation code