Kevin
Kevin

Reputation: 1479

Change main monitor on Mac programmatically

I would like to disable the primary monitor on a Mac and then change secondary monitor to be the main programmatically. Any help on how I can do this? Not sure where to start my research.

Upvotes: 2

Views: 1293

Answers (2)

Steve C
Steve C

Reputation: 21

hmscreens work great:

http://www.hamsoftengineering.com/codeSharing/hmscreens/hmscreens.html

Here's a sample command line to swap mointors:

hmscreens -setMainID `hmscreens -info | grep "Screen ID:" | head -2 | tail -1 | sed 's/[^0-9]*//g'`

Upvotes: 1

Frankie Tanti
Frankie Tanti

Reputation: 46

To change the secondary monitor to be the main screen is quite straightforward. One need to set the origin 0,0 to the secondary display using CGConfigureDisplayOrigin().

A full sample can be found Here

To the question how to disable the monitor, unfortunately I have no answer.I am trying to figure out how it can be done because there are some applications like SwitchResX that are able to disable displays, so somehow it must be possible.

Upvotes: 3

Related Questions