
Show HN: Figure out when you closed your MacBook lid - capablemonkey
http://sleep.gordn.org
======
josephpmay
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...](http://apple.stackexchange.com/questions/52064/how-to-find-out-the-
start-time-of-last-sleep))

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

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

~~~
ics
node-webkit presumably.

------
rcarmo
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.

~~~
danellis
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.

~~~
rcarmo
It's still disturbing. :)

------
sacrilicious
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.

~~~
rohandhruva
Way to stay on the point there.

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

~~~
azinman2
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.

~~~
guptaneil
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.

------
alxmdev
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.

~~~
woofyman
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.

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

------
eugeneionesco
node.js? Seriously?

~~~
capablemonkey
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

~~~
CrLf
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.

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

[https://github.com/jvinet/dotfiles/blob/master/bin/doorman.p...](https://github.com/jvinet/dotfiles/blob/master/bin/doorman.py)

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

Or how does this get called?

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

------
mirchada993
Funny you used a picture of a PC

------
solusipse
little node-webkit?

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

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

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

------
headShrinker
"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.

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

~~~
steffan
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.

------
giggles_giggles
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."

~~~
capablemonkey
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.

~~~
GordyMD
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! ;)

