check
Code:
nvidia-settings -q AssociatedDisplays
to see which dispalys is acutally associated with externa monitor (it must be used at the time) and then use itin your switching script or whatever you use for that ( desktop activator maybe ) with
Code:
nvidia-settings -a AssociatedDisplays=0x00010000
or whatever bitmask you will have.