Files
LidAngleSensor/README.md

100 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Lid Angle Sensor
Hi, Im Sam Gold. Did you know that you have ~rights~ a lid angle sensor in your MacBook? [The ~Constitution~ human interface device utility says you do.](https://youtu.be/wqnHtGgVAUE?t=21)
This is a little utility that shows the angle from the sensor and, optionally, plays a wooden door creaking sound if you adjust it reeaaaaaal slowly.
## FAQ
**What is a lid angle sensor?**
Despite what the name would have you believe, it is a sensor that detects the angle of the lid.
**Which devices have a lid angle sensor?**
It was introduced with the 2019 16-inch MacBook Pro. If your laptop is newer, you probably have it.
**My laptop should have it, why doesn't it show up?**
I've only tested this on my M4 MacBook Pro and have hard-coded it to look for a specific sensor. If that doesn't work, try running [this script](https://gist.github.com/samhenrigold/42b5a92d1ee8aaf2b840be34bff28591) and report the output in [an issue](https://github.com/samhenrigold/LidAngleSensor/issues/new/choose).
**Can I use this on my iMac?**
Not yet tested. Feel free to slam your computer into your desk and make a PR with your results.
**Why?**
A lot of free time. I'm open to full-time work in NYC or remote. I'm a designer/design-engineer. https://samhenri.gold
**No I mean like why does my laptop need to know the exact angle of its lid?**
Oh. I don't know.
**Can I contribute?**
I guess.
**Why does it say it's by Lisa?**
I signed up for my developer account when I was a kid, used my mom's name, and now it's stuck that way forever and I can't change it. That's life.
**How come the audio feels kind of...weird?**
I'm bad at audio.
**Where did the sound effect come from?**
LEGO Batman 3: Beyond Gotham. But you knew that already.
**Can I turn off the sound?**
Yes, never click "Start Audio" in the menu bar item. Weird of you to ask and kind off sad. :(
## Build and Run (Terminal)
You can build and launch the app without Xcodes UI using `xcodebuild`.
### Prerequisites
- macOS with Xcode or Xcode Command Line Tools (`xcode-select --install` and maybe `xcodebuild -runFirstLaunch`)
- Optional: GitHub CLI (`gh`) — or use `git clone` instead
### Clone
Using GitHub CLI:
```bash
gh repo clone samhenrigold/LidAngleSensor
cd LidAngleSensor
```
Or with Git:
```bash
git clone https://github.com/samhenrigold/LidAngleSensor.git
cd LidAngleSensor
```
### Build (Debug)
```bash
xcodebuild \
-project "LidAngleSensor.xcodeproj" \
-scheme "LidAngleSensor" \
-configuration Debug \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" DEVELOPMENT_TEAM="" \
-arch arm64
```
Notes:
- On Apple Silicon, `-arch arm64` is correct. On Intel Macs, you can use `-arch x86_64` or omit `-arch`. Intel macs don't have the feature tho, so it won't be very useful.
- Disabling code signing is fine for local debug builds if you are not mr. gold.
### Run
```bash
open build/Build/Products/Debug/LidAngleSensor.app
```
If you built a Release configuration, adjust the path accordingly (replace `Debug` with `Release`).