I’m looking for a way to programmatically move the menu bar on a multi-display setup from one display to another. Ideally I would do this in Objective C, but I’m open to shell scripts, AppleScript, etc.
In Objective C, I can get a pointer to the screen with the menu bar by using [[NSScreen screens] objectAtIndex: 0]. However, I obviously cannot write to that array.
Is there an NSUserDefaults preference I can switch? I ran defaults read > defaults.txt in Terminal to try to find the correct one, but it’s like finding a needle in a haystack 🙂
You can use a command line tool I created to do that here. You’ll also find the source code to the tool on the web page so you can see how I did it programmatically and use that as an example for your code. Good luck.