Show HN: C++ library for reading MacBook lid angle sensor data

47 ufoym 36 9/8/2025, 6:04:51 AM github.com ↗

Comments (36)

hebejebelus · 3h ago
OP, don't read this as a direct criticism of you.

I think the age of AI has really cheapened work like this. It's clear this library was vibe-coded; it's clear enough that the python version of the library originally posted yesterday was vibe-coded; I didn't look at the original library but it would shock me not at all that it was vibe-coded. Often just one or two commits and a functional library, emoji all over the readme, "Clean and easy-to-use API", etc.

In many ways this is pretty amazing. Only a few years ago it would have been a huge pain in the ass to come across some valuable library only for it to be locked in some language I didn't understand or wasn't working in at that moment. But in other ways, maybe it feels a bit "cheap" now to do `claude -p "port this library to $LANG, make sure it works, do a good job" and I'm not sure there's a ton of... accomplishment? craft? care? in it.

tobyhinloopen · 2h ago
AI also loves to explain what code does with stuff like this:

    // Check if sensor is available
    if (sensor.isAvailable()) {
      // Read current angle
      double angle = sensor.readAngle();
Which, to me, is a clear indicator of the author (being AI, I hope) not caring about code readability.
Aurelius108 · 1h ago
Unfortunately staff engineers at my company will demand annoying comments like this so I don't think it's necessarily a sign of vibe coding
socalgal2 · 51m ago
I get worse. I write a test

    TEST(SubSystemABCTest,CheckIfAIsNegativeItThrows)
    {
      ....
    }
And I get told all tests need a comment so I copy that line and add spaces between the words. WTF! >:(
saagarjha · 46m ago
One would hope that the principal engineers above them have more sense…
bapak · 2h ago
I need to create an AI agent that comments on any PR when it finds useless comments
Aurelius108 · 1h ago
Oddly enough I find senior engineers at my company demand ridiculous comments like this oddly enough. I've found that a 1:3 comment:code ratio (basically a comment every 2-3 lines with a new line separating each block) is the only thing that will prevent some annoying code review comments asking for clarifications.
tobyhinloopen · 1h ago
Give them a copy of Robert C Martin’s Clean Code hah
walthamstow · 2h ago
I'm fighting this shit so hard at work every day, every PR review. The LLM writes comments like someone who can't read code is going to read it.
balamatom · 31m ago
Bold of you to assume the majority of developers can read code.
ofrzeta · 2h ago
Yeah, it's typical for LLMs. A comment anti-pattern. I wonder if LLM explainability can deliver and answer on "why" they are doing it.
numpad0 · 2h ago
This one is hallmark of Arduino sample code, which consists a majority of materials found on the internet regarding sensors and code.

I think the original human intent is to inflate mental share on hardware and/or time domain issues as those are just routine occurences in Arduino projects.

moshib · 2h ago
At my $CORP job, I often see engineers enamored with creating new things. I completely understand the appeal -- it's fun to create something new, without preexisting constraints, with full ownership of the codebase.

However, the real challenge is what happens _later_, when the thing is done. Most people don't really think about maintenance, and move on to other things, making the thing they worked on stale and stagnant.

I think this applies here too: Vibe coding lets us create new _things_ quite easily, but we see value in places other than the sheer the existence of the project. We care about how the project is maintained, if it has a userbase, contributors, longevity. I think this is also part of why it feels so "cheap" and not genuine.

hebejebelus · 2h ago
Yes, indeed. I think that's why I haven't published much code in the last years since I vibe-code everything I build now and I have essentially no intention to maintain it once it's 'working'
teiferer · 2h ago
As an "AI" skeptic, let me ask an out-of-character question: Could such maintenance be automated or at least heavily simplified with coding agents? Looking over whether something breaks when gcc is upgraded, automatically updating if needed, updating best practices, automatically reproducing reported issues and proposing fixes ... too much of a dream?
hebejebelus · 1h ago
Yes, definitely some of it can be simplified or automated. I've been migrating various apps from a docker-compose to a kubernetes environment. Spending a day writing a solid prompt document and running some agent on the repos involved has drastically sped up my workflow.

The integration hell isn't much easier, but I spend _far_ less time actually writing configurations, yaml files, looking up docs, etc, which frees up my time so that I can deal with the workplace politics involved... actually, maybe I want to go back.

qq66 · 2h ago
On the other hand, this library probably wouldn’t exist without vibe coding, and you might never have known that the lid angle is readable.
hebejebelus · 2h ago
I think that's the thing I'm trying to say. _This_ library might not exist but anyone with an Anthropic account and the knowledge that there is a readable sensor can make it exist just as easily.
joenot443 · 3m ago
I completely agree.

I’d be so much more impressed if OP had come up with an interesting use case for this “library” rather than just writing a single prompt and firing up a Show HN

macOS has hundreds of APIs. I’m not really convinced every single one needs a Claude wrapper library, nor am I convinced OP did any amount of interesting engineering work here.

It’s a bit like releasing a music album comprised entirely of Suno tracks - sure, it’s there, you can press play, but is it something to be proud of?

saagarjha · 44m ago
Did you see the link to the repo that inspired this?
numpad0 · 1h ago
This couldn't have existed until someone else done it manually in Python and posted here on HN. The author likely fed that code to Claude or free tier Gemini.
bapak · 2h ago
> I'm not sure there's a ton of... accomplishment? craft? care? in it.

Who cares?

What's important is that now I have a useful library. The only complaint I'd give is that it might not be super optimized, but it's open source so you can instruct your agent to take it and optimize it for you :)

hebejebelus · 1h ago
This is pretty much what I'm trying to get at. Why would you even begin with _this_ library when you also have an agent that can build precisely the thing you want with the abstractions, constraints, etc that you want? What value does _this_ library have, considering that it takes you _exactly_ as much time and effort to build your own?
MangoToupe · 1h ago
Honest question, why bother publishing the code at all? Wouldn't it make more sense to publish the prompt?
hebejebelus · 1h ago
Yes, exactly. Unless you have a deep intention to maintain this library or somehow elevate it beyond the version anyone would get given a couple of minutes and Claude, what's even the point in publishing the code or submitting to HN? And what is the benefit for anyone to use _this_ library instead of getting Claude to build their own with whatever constraints and requirements they have?

Again I don't want to come across as criticising the OP, I am just struggling with this myself. I've vibe-coded a few great things for myself but the value is so personal (and the lack of intention to maintain is so strong) that I would rather others build their own version than use mine!

brettermeier · 29m ago
No, energy got used for LLM to produce this, why do it twice?
MangoToupe · 16m ago
That's a fair point.
krapp · 12m ago
I mean, we're supposed to care? We're here on a forum of programmers and technical people ostensibly gathered because we want to satisfy our intellectual and technical curiosity.

Hacker News is already full of people too misanthropic and uncurious to engage with topics beyond the title. Now we don't even care about the art and science of programming. So why bother showing up? This place will be nothing but shitposting bots and self-promotion soon.

madduci · 58m ago
And the Hungary Notation, typical of Win32 APIs?
boxed · 41m ago
A class for no reason is a bit weird too. This is just not idiomatic C++.
aa-jv · 2h ago
I think its easy to criticise vibe-coded work, if you're into programming for the sake of programming.

But if you're into programming for the sake of the user, none of this matters.

For me, I appreciate the clean, complete documentation and code generated for use in this project - I see nothing wrong with it, its useful and functional, and I can easily integrate this library into an app I'm building to get the screen angle. From this perspective, for the sake of the user/developer, I'd say things were definitely improved over Plain Ol' Human Code™ ...

hebejebelus · 2h ago
Ha, I'm not into programming for the sake of it. I vibe-code all the time now and don't think I've written a line of code by hand in over a year. I'm really not trying to criticise this library itself and I agree that in many ways it's quite good.

What I think I'm trying to say is that this specific kind of thing now takes everyone the same amount of time to create. It's "cheapened" this specific type of code. I'm not trying to say this particular library is bad or anything, just that converting some small library from one language to another no longer really holds much value, since essentially everyone can do exactly the same thing exactly the same way now, for the same time cost.

aa-jv · 38m ago
I think the point where we diverge is that this is a good thing:

>everyone can do exactly the same thing exactly the same way now, for the same time cost.

It doesn't have to be cool. It just has to work.

tos1 · 3h ago
Cool! I'm wondering why is the lid-opening angle a 16 bit value without any scaling? Can MacBooks be opened > 255°? :)

(https://github.com/ufoym/mac-angle/blob/main/angle.cpp#L186)

chippiewill · 4m ago
It's a low level library, it's probably just the register on the sensor itself is 16bit so that's what gets propagated up to the OS.

The most I can reach on mine is 132deg

GranPC · 2h ago
Technically yes - might have a bit of a hard time closing it back down tho.