Did you know your MacBook has a sensor that knows the exact angle of the screen hinge? It’s not exposed as a public API, but I figured out a way to read it and make it sound like an old wooden door.
You can download this test app and try it yourself. https://github.com/samhenrigol... I have so much free time it’s unbelievable. I’m open to full-time work in NYC or remote. Senior product designer/design engineer. https://samhenri.gold
you know what? screw it. theremin mode. https://github.com/samhenrigol...
@samhenrigold Nice!! For people who wonder how it looks like:
@MehdiHacks i wanna eat it
@samhenrigold Hey is there a tutorial to run this? I downloaded the source files - I'm not really great with computers 😅 Would really appreciate your help!
@MostafaVisuals there’s a precompiled version in the Releases section
@samhenrigold Why the app is showing 280 degrees when the lid is open slightly more than 90? Are you displaying the angle in Fahrenheits?
@YaroslavBunyak screwed up the calculation, it should work correctly now: https://github.com/samhenrigol...
@samhenrigold What would be a good use of this?
@hermescaste pacman controller where you have to open and close the laptop to move
@samhenrigold Doesn't work for the M1 MacBook Air!
@AspiringAntel yeah i heard a couple reports of this, I gotta go to an Apple Store or a Best Buy or something to run some tests
@samhenrigold what section of the code get the sensor values exactly? It's easier for me to read asm code than Objective-C hahahaha
@paulopacitti this whole file but I ask for the value from the sensor here #L121 class="text-blue-500 hover:underline" target="_blank" rel="noopener noreferrer">https://github.com/samhenrigol...
@samhenrigold cool... but why is it monitoring the keyboard?
@theapache64 IOHIDManagerOpen, which I use to monitor the lid angle sensor, is more commonly used by people to monitor input devices (i.e. a keyboard). It’s so low level that Apple just assumes someone is using it to drink from that event monitoring firehose.
@samhenrigold I love this 👀👀👀👀👀
@klemensstrasser i feel like this would lend itself well to a theremin simulator
@samhenrigold Pretty cool that it has the sensor but why though? What does it enable that couldn’t be done with a single binary (closed/not closed) sensor?
@samhenrigold Nice! Like old times. On '90s-era Macs, you could add sound effects to any detectable event with freeware like SoundMaster by Bruce Tomlin. Insert a diskette into the SuperDrive, our would chime, “Thanks! I needed that!” You can still download it from his site—for System 7, lol
@samhenrigold It shows 335 degrees, which is closer to a circle than an angle.
@samhenrigold Just dove into your LidAngleSensor project and I'm curious - what inspired the Theremin mode? 🎵 Was it a specific use case or just a fun experiment?
@samhenrigold That’s a clever hack! Who knew MacBooks had such hidden talents? Inspiring to see creativity unlock new ways of experiencing technology.
@samhenrigold Neat one , cool hack and also funny implementation
@samhenrigold Amazing, worked immediately. Would be great to have it as an app you can keep in your menu bar, and also to have a minimum threshold for it to not work (the theremin keeps humming when the lid is closed).
@samhenrigold When it closes all the way, is there a sensor you can read to make it go "KA-BAM!" like the door slams shut?
@samhenrigold idea: Hidden panic button in robbery or similar scenarios



