A python package to read macbook lid angle.
Project description
MacLidSensor - MacBook Lid Angle Sensor Interface
A lightweight Python module for reading MacBook lid angle sensor data using the HID interface on macOS. This package provides direct access to the built-in Apple lid angle sensor — no kernel extensions or private APIs required.
Features
- Instant angle readings — Read the current MacBook lid angle in degrees
- Minimal dependencies — Only relies on hidapi
- Simple class API — Easy to integrate into scripts or applications
Requirements
- macOS (tested on Apple Silicon)
- Python 3.7+
- Modern MacBook with lid angle sensor
Installation
Install via pip:
pip install maclidsensor
Quick Start
from maclidsensor.sensor import LidSensor
sensor = LidSensor()
angle = sensor.read()
print(f"Lid angle: {angle}°")
Output example:
Lid angle: 108.0°
Acknowledgements
Based on reverse engineering of the IOKit HID interface used by Apple's internal sensor framework.
This package was made possible by the reverse engineering work done by Sam Henri Gold in the LidAngleSensor project. The key insights about the HID Feature Reports and data format were discovered through that original research.
License
This project is licensed MIT LICENSE.
See the LICENSE file for full details.
Contributing
Contributions are welcome! Whether you’ve discovered a new sensor variant, want to improve error handling, or just fix typos — all PRs are appreciated.
How to Contribute
-
Fork the repository on GitHub
-
Create a new branch for your feature or bug fix
git checkout -b feature/my-improvement
-
Make your changes, ensuring code is clean and concise
-
Run tests or verify the sensor behavior on your MacBook
-
Commit and push your changes:
git commit -m "Add: Improved connection logic for sensor detection"
git push origin feature/my-improvement
- Open a Pull Request on GitHub and describe your change clearly
Guidelines
-
Keep commits atomic and well-labeled
-
Use type hints where applicable
-
Avoid breaking public APIs
-
Add docstrings for new classes or functions
If you encounter a model that doesn’t work or returns unexpected data, please open an issue and include your:
-
macOS version
-
MacBook model
-
hid.enumerate() output snippet
Your feedback helps improve compatibility across devices.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maclidsensor-1.0.3.tar.gz.
File metadata
- Download URL: maclidsensor-1.0.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77344cf71d74002d9b2c024d3a9a718e0d608c0a80fb02322f9d838179c37014
|
|
| MD5 |
44587ff9a751c6539b7626d322d38f14
|
|
| BLAKE2b-256 |
a486928b74a08ae480849fed4faa29a7a581aa1e5d5b5213cde145ca44185136
|
File details
Details for the file maclidsensor-1.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: maclidsensor-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03cb8b33d4517886ae304af00a5c4e7bdfcd72e06a2519d2474b0cafb0364561
|
|
| MD5 |
4ff8c60f0c54031d3822eb6bc7a9b03f
|
|
| BLAKE2b-256 |
7d2d8e4a486cc35ef578fbbc846670e03a5ac086893749d1de9248fd1f4abbf5
|