How place a menu bar icon to a specified place by code?

Is there a way that we place a menu bar icon on a specified place?
In the article the user can move the icon, but how can I place the icon of my application to a specified place by code?

How to Rearrange and Remove Your Mac’s Menu Bar Icons

No, there’s no way to place an NSStatusItem where you choose. It just gets added to the bar when it’s loaded. Many years ago there was an undocumented API that allowed you to do it but it’s long since been disallowed by Apple.

… i don’t think that is a good idea to overwrite user settings except you use your app only for yourself.

Can it be done in Linux?
Tim