HomeArticle

Turn your MacBook into an electronic scale in seconds! A programmer has modified the trackpad. After the open - source project gained 2600 stars, the programmer urgently advised netizens not to use it to weigh themselves.

CSDN2025-07-24 09:18
Software + Hardware: Geek programmers unlock new ways to use the MacBook trackpad.

Can the MacBook Pro, usually used for video editing and coding, actually be used as an electronic scale to weigh things?

Recently, Krish Shah, a maker from Canada, suddenly had an idea. After some creative tinkering, he showed off a really cool project on X: He developed an app that can instantly turn the Force Touch trackpad in the middle of a MacBook Pro into a small electronic scale, which can be used to weigh small items like freshly ground coffee beans, remote controls, and small bottles of drinks.

From his video demonstration, the error between the weighing result and the actual weight is controlled within 2 grams.

This may sound a bit unbelievable, but this project is indeed completed based on the real software + hardware capabilities of Apple laptops.

An App "Transforms" the MacBook

As we all know, since 2015, MacBook Pro models and MacBook Air models after 2016 have been equipped with the Force Touch trackpad. Its functions are not limited to recognizing click actions, but also can sense the pressure of pressing.

Apple originally designed it for operation gestures like "press firmly to look up in the dictionary". Unexpectedly, this design became the key to realizing the weighing function in this project.

Specifically, the app developed by Krish Shah is called TrackWeight. It uses the "pressure sensing" function of Force Touch to turn your MacBook into an electronic scale. Its principle is not complicated - the app reads the pressure data sensed by the trackpad and converts it into a weight reading.

Shah explained that all this can be achieved because the trackpad of the MacBook is not a traditional touch panel, but a force sensor with haptic feedback, which simulates the feeling of "clicking" through software.

Some people may wonder: Since the hardware has met the conditions for a long time, why hasn't anyone done this before?

Shah revealed that it's because he found a private API in the Apple system that can obtain real - time pressure data when your finger touches the trackpad.

When a netizen asked how he found this private API, Shah simply replied, "Through a lot of in - depth research."

Its usage steps are also very simple:

Open the TrackWeight app

Lightly touch the trackpad with your finger and keep it in contact

Place the object you need to weigh on the trackpad

Without lifting your finger, try not to apply extra pressure to the trackpad. Wait for the reading to appear on the screen, and then you'll get the weight of the object

In terms of the technology stack, TrackWeight uses SwiftUI to build the interface and the Combine framework to achieve smooth data transmission. Therefore, TrackWeight looks more like a native macOS app.

In addition, Shah also mentioned that he used the Open Multi - Touch Support library (https://github.com/Kyome22/OpenMultitouchSupport) developed by another programmer, Takuto Nakamura, to further improve the accuracy and playability of the app. The power of this library lies in its ability to monitor global multi - touch events on macOS and obtain detailed data of the trackpad, including position, pressure, angle, density, etc. In addition, this library also provides thread - safe asynchronous/await support, tracks touch states, and accesses comprehensive sensor information.

Currently, the code of the TrackWeight app is open - sourced on GitHub (https://github.com/KrishKrosh/TrackWeight) under the MIT license, which allows free modification and distribution.

Within just two days of the project's release, it has received 2.6k Stars, indicating its popularity.

Some Limitations

On the GitHub project page, Krish Shah specifically reminded that not all Macs can use TrackWeight. Users who want to try need to meet the following conditions:

System requirement: It must run macOS 13.0 or a higher version to ensure compatibility with the Open Multi - Touch Support library.

Hardware limitation: It only supports MacBooks equipped with the Force Touch trackpad, that is, MacBook Pro models from 2015 and later, and MacBook Air models after 2016.

Permission settings: Since it needs to access the underlying hardware, the App Sandbox must be turned off (this is a prerequisite for achieving low - level trackpad access).

Development environment: Xcode 16.0 or a higher version and Swift 6.0 or a higher version need to be installed, mainly to support the necessary dependencies during the development and running process.

Shah also specifically stated that TrackWeight is currently still an experimental project, mainly for enthusiasts to explore and learn. It is not recommended for use in commercial scenarios or scenarios with strict accuracy requirements.

In addition, the working mechanism of Apple's Force Touch determines that when using TrackWeight, your finger must always be in contact with the trackpad (capacitive sensing must be continuous) for the system to output valid pressure data.

This operational requirement may slightly affect the weighing accuracy because you're not sure how much pressure your hand on the trackpad will bring. But Shah's actual test shows that "the accuracy is still quite good."

To verify the weighing effect, he also conducted a series of comparative experiments: He placed the MacBook directly on an electronic scale. With his finger in contact, he placed items of known weight one by one and then compared and calibrated the results shown by TrackWeight with the readings of the electronic scale.

The test results show that the readings are very stable whether it's a light item or a slightly heavier one. What's even more surprising is that the pressure values read through MultiTouchSupport are already output in "grams", hardly requiring manual conversion.

Of course, this small tool also has some "small pitfalls" in use:

Metal objects may be misjudged as "fingers" because they may trigger capacitive sensing. Shah suggests placing a tissue when weighing metal items to avoid system misrecognition.

The item should be placed within the range of the trackpad. If it's placed crookedly or goes beyond the edge, the weighed weight may be inaccurate.

Be Cautious When Testing: Some Tried to Weigh Their Body or Luggage, and the Result...

As soon as the TrackWeight project was released, it sparked a lot of discussions on Hacker News and Reddit.

Some people had wild ideas: Can this thing be used as a weighing scale for the body? And can it be used to weigh luggage?

Before Shah could say "Don't weigh your luggage on your MacBook", someone crushed their MacBook in half.

This made Shah leave an urgent message on social media, saying that the lightest item he had weighed was 1g, and the heaviest was only 3.5 kilograms.

Don't try to weigh heavier things. It's not that TrackWeight can't do it, but the MacBook itself can't bear it. You can have fun, but don't overdo it.

Once the weight limit is exceeded, two situations may occur: Either, as mentioned above, there will be hardware problems, such as the trackpad glass breaking or the internal structure being damaged; or there will be software errors, and the read pressure values will be distorted and can't be accurately converted into grams.

Of course, it's still good for weighing small items:

However, some netizens think it's not very accurate when weighing light objects, but they still can't help but exclaim, "It's so cool! I may not use it as an electronic scale, but it's really good as a demonstration to show off to friends."

This experience has also piqued the interest of many netizens in the way of "unearthing the hidden skills of hardware".

A netizen also shared his past experience: "More than a decade ago, he used the hard - drive vibration sensor of a PowerBook to DIY a simple seismograph called SeisMac and even collected vibration data from users around the world. Although it can't be regarded as rigorous scientific research, the feeling of creating while having fun was really enjoyable."

Some also pointed out that there are actually many "private frameworks" hidden in the macOS system. As long as you're willing to tinker, underlying libraries like OpenMultiTouchSupport can be extracted and packaged into development tools. "It's not that difficult."

The emergence of TrackWeight has indeed inspired a lot of creativity: Some said they want to add a "micro - scale" function to kitchen apps; some envisioned linking it with smart home devices; and some even hope that Apple officially integrates this function to make a small scale with fine - tuning capabilities.

Think about it, it doesn't seem impossible.

References:

https://github.com/KrishKrosh/TrackWeight

https://www.tomshardware.com/laptops/macbooks/macbook - pro - trackpad - can - double - as - a - weighing - scale - and - the - source - code - is - free - creator - hacks - trackpad - to - weigh - items - claims - force - touch - system - pretty - accurate

https://www.reddit.com/r/macapps/comments/1m5tha5/trackweight_turn_your_macbooks_trackpad_into_a/

https://news.ycombinator.com/item?id=44635808

This article is from the WeChat official account "CSDN". Compiled by Tu Min. Republished by 36Kr with permission.