But if the Bluetooth isn't on to begin with... d'oah!
I'm trying to do the same thing, and have had limited success with an app called Control Plane. Please understand that I am pretty computer illiterate so this may not be the best way, or even a good way to accomplish this. http://www.controlplaneapp.com/
It allows you to automatically toggle bluetooth(and many other aspects) on or off under certain contexts. I tried setting it up to detect the display connection but sometimes it would detect the display, and sometimes it wouldn't. So I set it up to detect the specific power adapter for the display. So when I plug the monitor power adapter in it switches to the context i labeled "monitor" and I set an action to toggle bluetooth on under this context, when I unplug the power adapter it switches to a context I've named "battery" and turns the bluetooth off.
Automatically turning the bluetooth on is specific to only connecting the monitor power adapter, when other power adapters are connected it does not turn bluetooth on. But it is limited in the fact that if I have bluetooth on in instances other than the monitor connection, and then disconnect any power adapter, it will automatically turn the bluetooth off.
Also if my computer is in clamshell mode, and therefore asleep, when I plug the monitor+power adapter in it doesn't automatically turn on bluetooth, and I cannot use my bluetooth keyboard or trackpad to wake the computer. This forces me to open the computer momentarily to allow it to wake up and control panel to turn on bluetooth for me.
Since my main issue was that I didn't want bluetooth on constantly to save battery life, this works for me, but it is not ideal. Ideally connecting the monitor to the computer in clamshell mode would wake it from sleep, but as of now I can't figure out how to make it do that. If you have any suggestions on how to make this process more efficient please let me know. Hope this helped.
chrisb7686 - thanks for the reply and the great suggestion. I tried it out myself but since I'm running a developer version of an unreleased version of OSX, none of the functions worked. That or I didn't know how to use it.
I set up so that when I plug in the power adapter, the bluetooth will disconnect, and it was labelled as automatic.
It never worked. Tried some different sources and different triggers as well. Not a single one worked, while the app was running and stable.
I have not found anything else that works either. So far, I'm still stuck turning the bluetooth off manually once I leave home. Because I the same am trying to save battery power.