Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Figure out when you closed your MacBook lid (gordn.org)
45 points by capablemonkey on Mar 22, 2015 | hide | past | web | favorite | 47 comments

If you don't want to install an application, you could type something like

  pmset -g log|grep -e " Sleep  " -e " Wake  "
And get the same results (although a bit harder to sift through)

(source: http://apple.stackexchange.com/questions/52064/how-to-find-o...)

+1. Yup. Sleep is a 98MB wrapper around pmset. :)

Holy crap. The DMG is 33MB. What is being done that's so huge?

node-webkit presumably.

The use of Node-webkit for this... is disturbing. It's not that hard to code this in Obj-C, and I have menu bar applets that take... 200KB RAM.

I don't think it's meant to be taken entirely seriously, and I think the use of Node-WebKit is supposed to be part of the satire.

It's still disturbing. :)

Good for you making an app to scratch your own itch! Pardon being negative when I know you are sharing some of your self with the world by showing HN. I don't even mind the runtime tomfoolery, but it's disingenuous to say "Apple doesn't trust you to make grown-up decisions yet about what applications you want to run".

First off, "yet"? They're going to change they're mind at some point about code signing?

And second, nw.js apps like Kitematic can sign their code, no matter how quick a hack this is don't belittle Apple's security to explain away your laziness of not signing your app.

Thank you for sharing, although the glamorizing of killing yourself for work is also a bit disturbing.

Way to stay on the point there.

Technical content aside, anyone else think that need for this app is a pretty good indicator of some rather unhealthy sleep habits?

Ya this is not a problem I've ever had. If I'm that tired I just go to bed. I've had many a late night but never such that I'm unable to control where it is I fall asleep. Not sure how common thesw habits are.

I think it's more common among students (which the author happens to be). I used to fall asleep on my laptop during all-nighters in the library fairly often in college, when I didn't have the luxury of just going to sleep because I was tired.

It is.

On the other end of the spectrum, we've got things like redshift, and redshift-schedule, which alter the temperature on your screen to avoid sleep-depravation and actually maintain healthier sleeping habits.

I used both, especially for a time when I started migrating to polyphasic sleep.

Yup. I thought about building something like it, and my sleeping habits are pretty bad.

I find the technology choice here very interesting, a desktop applet programmed with what I look at as mainly web technologies (JavaScript, JSON, Node, Webkit). It's impossible to ignore how the landscape has changed in the past 5 years and how web-style programming is slowly bleeding into spaces dominated by native applications.

When I first got into software development years ago with an eye for tools and games, I approached web programming as a stepping stone. I wonder what direction I would go if I were to start over today.

I prefer to put as few layers of abstraction between me and the hardware as feasible. Maybe because the first part of my career was in embedded software.

Microsoft was way ahead of their time with this. Windows has supported HTML Applications and JavaScript scripts for decades.

Whenever I find myself asking this question the answer is always "too late". Cool idea.

node.js? Seriously?

Yes. node-webkit / nw.js is really slick. I love that I can create a desktop app without even a hint of Cocoa or Obj-C on my part. The runtime is like 90mb, yes, but the source itself is 4mb including dependencies. Memory usage is decent at ~18mb

I don't know about you, but I don't want an applet as small as this eating up 18MB...

Really, what's up with you people?

BTW, not saying that the idea is bad or anything, but it's sad to see people talking about such a waste of resources like it's OK to use in "production". People have other stuff running on their machines and it adds up, quickly.

> The runtime is like 90mb, yes, but the source itself is 4mb

Not to be too acerbic, but, first of all, 4 MB is already huge for an applet. Secondly, how does the fact that the source is 4 MB excuse the 90 MB runtime?!

Please pardon my zeal, but...

18mb is not decent for such a simple little app! What?!?!

I love that I can create a desktop app without even a hint of javascript / webkit / nodejs

Sure, there are a lot of other languages to write this little app in, but why not?

There are plenty of other languages that are probably already installed on a given person's laptop (e.g.python, ruby, clang, swift now? etc. come built in) that also are better suited for an user-facing app with no web dependencies.

Not to mention webkit running a menu bar app is nauseous, though I would certainly hope 99% of the framework isn't involved.

we are everywhere and we're not even java

If you're on Linux, you can accomplish this with dbus.


What else do you need running for this? I don't see anyone exposing "org.freedesktop.login1.Manager".

Or how does this get called?

It's a real shame it's OS X only, I'd love to have this on my MacBook otherwise! :(

Funny you used a picture of a PC

little node-webkit?

Well, nw.js[1] to be precise. It is a pretty small application.

[1] https://github.com/nwjs/nw.js/

Not the binary or the runtime, since it wraps around some pretty huge stuff.

"If you get an error saying that this app is from an unknown developer, that's because Apple doesn't trust you to make grown-up decisions yet about what applications you want to run. Just find Sleep app in your Applications folder, right click on it, and click Open."

Yes, Apple doesn't trust you, and with good reason. I think we have properly demonstrated the average public has no sense at all when when it comes to running software from unknown developers with the chance that it is potentially malicious and damaging.

Developers should just sign their apps. Apple even gives signing keys away free of charge.

Do you mean if you already have a paid Mac / iOS developer account? That's the only way I've seen that provides the ability to sign an app.


The setting to turn that off permanently is really only a couple of clicks away. "Grown-ups" know how to find it easily. Others are better off not being able to do it without understanding how it works.

I don't think developers do either. Apple prompting you when you run an untrusted app for the first time is almost certainly a good thing (app replaced with a malicious one? you'll get an unexpected prompt), and it hurts nobody.

If someone has the power to replace an installed app on my machine, it's already game over.

How so? On OS X that doesn't require admin rights.

Sounds to me like the real solution to this problem is to have some sleep hygiene and get off of your laptop for awhile when you get sleepy.

If I was frequently waking on the couch with my laptop on my chest I wouldn't think "gee, did I get enough sleep? I should write an application that detects what time I doze off on the couch!" I'd think "Wow, I need to address my late night computing habits, as they're clearly interfering with my sleep."

Haha. Yes. I suppose you're right. I work full time and go to school full time so sleep is a luxury and I typically find myself working late nights.

So you want to answer the questions 'when did i fall sleep last night?' and 'did i get enough sleep?' I have to wonder why.

It suggests you are wanting to ensure you get a healthy amount of sleep by getting the answers to these questions. But really, you don't need to answer these questions at all. Instead just time-box the amount of sleep you should have (whatever you determine that to be) and then just set alarms on your phone/laptop around your schedule to instruct you when to go to bed and when to sleep - sorted.

I sense your overly elaborate, approximate solution to your problem is a result of you suffering from sleep deprivation! ;)

Oh I understand! Please read my comment as concern and not derision :)


> and you have no right to

he has no right to do what? say that he thinks it's a bad idea? of course he does.

Note, this is probably troll copypasta from some recent article.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact