Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I tried this over on Apple's Developer forum, but no takers. Wonder if anyone here can help me.

I need my code to evaluate whether an external display is connected via a mini-display port. I'm thinking I should be able 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/

I've also noticed that WindowServer process sends messages to console on connection of the external display such as:

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

So perhaps another approach would be to have my script monitor the log files for those messages. However, not only am I not exactly sure how to do that without monitoring loads of useless log messages, but it also seems a bit clumsy. There must be a neater way to get the state of the video port, right??

Any suggestions on how to do this (anything in applescript, bash, objective-c, or plain-old c will do)?

Thanks in advance.

share|improve this question

closed as off-topic by bmike Mar 16 at 13:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here, but can be asked on Stack Overflow." – bmike
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Developer questions are off topic here this should be on StackOverflow –  Mark Jan 21 '13 at 11:40
    
I just figured that out from the FAQ. Have already posted it there. Suggest you close this. –  applehelpwriter Jan 21 '13 at 11:48
    
How to bash script and access ioreg and system information is very much on topic here. Hit us up on Ask Different Meta if this isn't crystal clear from the faq –  bmike Jan 21 '13 at 11:56
    
I thought the FAQ was clear. The thing is I went to Stack Overflow first, but saw people referring queries to THIS site on the grounds that the queries were too Apple specific for Stack Overflow. So I posted here, only to find the FAQ say 'no programming questions'....?? So now I've posted on Stack Overflow too, and maybe I am confused after all...(an either way I still don't have an answer to my question :p ) –  applehelpwriter Jan 21 '13 at 12:08
    
Some way towards [an answer on Stack Overflow][1] as it turned out. [1]: stackoverflow.com/questions/14437643/… –  applehelpwriter Jan 21 '13 at 14:09

Browse other questions tagged or ask your own question.