objective c - How to programmatically enter target display mode? -
i've attached mba imac using thunderbolt cable. pressing cmd+f2 on imac enables target display mode utilize imac display mba. have info how trigger event programmatically?
my first approach send cgeventpost
kcghideventtap
cgeventref f2commanddown = cgeventcreatekeyboardevent(src, (cgkeycode)120, yes); cgeventsetflags(f2commanddown, kcgeventflagmaskcommand); cgeventref f2commandup = cgeventcreatekeyboardevent(src, (cgkeycode)120, no); cgeventpost(kcghideventtap, f2commanddown); cgeventpost(kcghideventtap, f2commandup);
that doesn't work. error "beep". (tried running root user too). think, kcghideventtap
wrong target , cmd+f2 might live in higher level of os (aka. "somewhere")
running key-event capturing code doesn't show cmd+f2.
does have hint? in advance!
i've started project this, namely monitor imac , automatically trigger target display mode , toggle off bluetooth when macbook connected. can download https://github.com/duanefields/virtualkvm. i'm using applescript trigger keys.
objective-c cocoa osx-mountain-lion
No comments:
Post a Comment