Control of Marangoni-driven patterning by an optimized distribution of surface energy