Is there a script that could be written to achieve this: In System Preferences/Displays... is it possible to relocate the menu bar ...via a script? My set-up is one monitor and a Cintiq. I either work only with the Cintiq, or I work with my 28" monitor several times a day. I always need to go to do this manually. I really wish there was a script that can do this. I tried Automator, but it's not recording the action. :(
You can use a command line utility named cscreen to do that. You can wrap it in a AppleSctipt script or in Automator. You can download the cscreenIntel.dmg from the link provided. In a terminal use
cscreen -h to output the internal help information.
I have a MBP and a Thunderbolt Display so in a Terminal I want to have
cscreen list my displays
$ cscreen -l DisplayID Index Depth Width Height Refresh 5ac6fa7f 1 32 1440 900 0 3247b0f 2 32 2560 1440 0 use -h to display all usage options $
So to set the Thunderbolt Display to have the menu bar I run the following command:
cscreen -s 2 -p
I can then toggle it back using the same command as the Index shifts.
do shell script "/<path_to>/cscreen -s 2 -p"
In Automator add Run Shell Script and add command:
/<path_to>/cscreen -s 2 -p
Note: This is a simple toggle if you only have two displays however if you have more then two you'll need to write some logic flow into the script.
You can also use,
cscreen -i <DisplayID> -p, e.g.
cscreen -i 3247b0f -p to code with the
DisplayID which doesn't change.
This can also just be used in a Terminal as a singular command or incorporated into a shell script without using AppleScript and or Automator.
A simple approach could be enabling "displays have separate spaces" in system prefs/Mission Control. That would enable menubars on both screens.
For multi-monitor setups the tool I wrote, displayplacer, does this.
Configure your screens how you like, drag the "white bar" to your primary screen in the macOS system settings, and then execute
displayplacer list. It will output the command to run to put your screens in their current configuration. The screen with
origin:(0,0) is the main display with the "white bar". Run this terminal command through a script, Automator, BetterTouchTool, etc.
Example profile 1 puts the white bar on the menu bar on the left monitor.
displayplacer "id:<leftScreenId> res:1920x1080 scaling:on origin:(0,0) degree:0" "id:<rightScreenId> res:1920x1080 scaling:on origin:(1920,0) degree:0"
Example profile 1 puts the white bar on the menu bar on the right monitor.
displayplacer "id:<leftScreenId> res:1920x1080 scaling:on origin:(1920,0) degree:0" "id:<rightScreenId> res:1920x1080 scaling:on origin:(0,0) degree:0"
Also available via Homebrew
brew tap jakehilborn/jakehilborn && brew install displayplacer