Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to detect if external display is present

I need my code to evaluate whether an external display is connected via a mini-display port.


Ideally, I'd like to do this by having a bash command that determines a boolean True/False value for the presence of a file. I'm just not sure what file I should be looking for, presumably something in /dev/


Any suggestions what it should be, or suggestions of a better way to make the determination (anything in applescript, bash, objective-c, or plain-old c will do)?


TIA

OS X Mountain Lion (10.8.2)

Posted on Jan 20, 2013 2:13 AM

Reply
2 replies

Jan 20, 2013 2:17 PM in response to softwater

It seems the process I need to monitor is the WindowServer, which sends messages to console on connection of the external display like


21/01/2013 04:24:11.647 WindowServer[81]: Display 0x5b81c5c1: MappedDisplay Unit 1: Startup Mode 1920 x 1080, CGSThirtytwoBitColor, Resolution 1, IOMode 0x3e, IODepth 0x2, IOReturn 0x0


The question is how do I intercept those messages in my script? I don't need to manipulate the settings, just have my script evaluate whether an ext. display is present or not.

how to detect if external display is present

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.