MacOS – How to get the postion of the lid

cocoamacbook promacosterminal

I am trying to figure out what the position of the lid is. Whether it is open or closed. Is there a terminal command or a cocoa code snippet for this?

I've already tried pmset -g but i can only get the sleep modes and the lidwake status.

Best Answer

I don't have a macbook by my side, is maybe

ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState  | head -1

still working ?