KrishKrosh / TrackWeight
Use your Mac trackpad as a weighing scale
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing KrishKrosh/TrackWeight in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Summary (README)
PreviewTrackWeight
Turn your MacBook's trackpad into a precise digital weighing scale
TrackWeight is a macOS application that transforms your MacBook's trackpad into an accurate weighing scale by leveraging the Force Touch pressure sensors built into modern MacBook trackpads.
https://github.com/user-attachments/assets/7eaf9e0b-3dec-4829-b868-f54a8fd53a84
To use it yourself:
- Open the scale
- Rest your finger on the trackpad
- While maintaining finger contact, put your object on the trackpad
- Try to put as little pressure on the trackpad while still maintaining contact. This is the weight of your object
How It Works
TrackWeight utilizes a custom fork of the Open Multi-Touch Support library by Takuto Nakamura to gain private access to all mouse and trackpad events on macOS. This library provides detailed touch data including pressure readings that are normally inaccessible to standard applications.
The key insight is that trackpad pressure events are only generated when there's capacitance detected on the trackpad surface - meaning your finger (or another conductive object) must be in contact with the trackpad. When this condition is met, the trackpad's Force Touch sensors provide precise pressure readings that can be calibrated and converted into weight measurements.
Requirements
- macOS 13.0+ (Ventura or later)
- MacBook with Force Touch trackpad (2015 or newer MacBook Pro, 2016 or newer MacBook)
- App Sandbox disabled (required for low-level trackpad access)
- Xcode 16.0+ and Swift 6.0+ (for development)
Installation
Option 1: Download DMG (Recommended)
- Go to the Releases page
- Download the latest TrackWeight DMG file
- Open the DMG and drag TrackWeight.app to your Applications folder
- Run the application (you may need to allow it in System Preferences > Security & Privacy for unsigned builds)
Option 2: Homebrew
brew install --cask krishkrosh/apps/trackweight --force
Option 3: Build from Source
- Clone this repository
- Open
TrackWeight.xcodeprojin Xcode - Disable App Sandbox in the project settings (required for trackpad access)
- Build and run the application
For more information about setting up the build pipeline, see .github/workflows/README.md.
Calibration Process
The weight calculations have been validated by:
- Placing the MacBook trackpad directly on top of a conventional digital scale
- Applying various known weights while maintaining finger contact with the trackpad
- Comparing and calibrating the pressure readings against the reference scale measurements
- Ensuring consistent accuracy across different weight ranges
It turns out that the data we get from MultitouchSupport is already in grams!
Limitations
- Finger contact required: The trackpad only provides pressure readings when it detects capacitance (finger touch), so you cannot weigh objects directly without maintaining contact
- Surface contact: Objects being weighed must be placed in a way that doesn't interfere with the required finger contact
- Metal objects: Metal objects may be detected as a finger touch, so you may need to place a piece of paper or a cloth between the object and the trackpad to get an accurate reading
Technical Details
The application is built using:
- SwiftUI for the user interface
- Combine for reactive data flow
- Open Multi-Touch Support library for low-level trackpad access
Open Multi-Touch Support Library
This project relies heavily on the excellent work by Takuto Nakamura (@Kyome22) and the Open Multi-Touch Support library. The library provides:
- Access to global multitouch events on macOS trackpads
- Detailed touch data including position, pressure, angle, and density
- Thread-safe async/await support for touch event streams
- Touch state tracking and comprehensive sensor data
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This application is for experimental and educational purposes. While efforts have been made to ensure accuracy, TrackWeight should not be used for critical measurements or commercial applications where precision is essential. Always verify measurements with a calibrated scale for important use cases.