Live data from Hacker News

Show HN: Prevent your computer sleeping with just a webpage

nosleep.page

41–50 of 137 posts

Re: Show HN: Prevent your computer sleeping with just a webpage

#43
post #33
post #21

Earlier quoted context omitted.

Does this stay on indefinitely? I don’t like using the command line to enable settings that I only need for an hour or so. I often forget to turn them off. I like that OP’s site turns keeps my machine awake while it’s open, and I can just close the tab when I want my machine to behave normally.

> Does this stay on indefinitely? If you want. If you don’t, use the `-t` flag for it to turn off after a set number of seconds or `-w` to do so after a specific process ends.

The more unixy way is probably `timeout caffeinate` :)

Re: Show HN: Prevent your computer sleeping with just a webpage

#44
post #34

Why not just use keep awake? https://chrome.google.com/webstore/detail/keep-awake/bijihla...

I can think of a few reasons. Looking at that page, the extension seems to only be compatible with Crome OS. A pretty limited audience can use that.

Also, I assume this is a pet project of the author. They had a need, and found a way to solve it. They probably had fun, and learned some things along the way. Often, that’s kind of the whole point of a weekend project.

Even if there is another established solution, ‘Why not just … some other thing’ isn’t great feedback. Discovering people’s ideas and projects is one of the beautiful things about HN.

This is a perfect example. I didn’t even know the Screen Wake Lock API existed, so I learned something new!

Re: Show HN: Prevent your computer sleeping with just a webpage

#45

So I like this and I'm trying it out, it seemingly works OK. However, the GREEN background is very annoying. I don't need the whole webpage to be green for me to know it's on and working. I can't minimize the browser (firefox) because then it apparently doesn't work. So I'm left with a very big green screen sitting in the corner of my eye. Wondering too the effect of that in terms of screen color burnout (if that's e…

> I can't minimize the browser (firefox) because then it apparently doesn't work.

Can't you have a separate, tiny window?

Re: Show HN: Prevent your computer sleeping with just a webpage

#47
post #42

Does it really need to be 12 Kb of obfuscated JS+CSS? That seems huge for the task.

Most of the JavaScript is two empty videos encoded in WebM or MP4, encoded using Base64 to be stored in plain text, and picked depending on what the web browser supports. Considering I doubt that video formats are designed with empty videos in mind, this is probably not too bad. As for why videos are here, they are a fallback in case web browser doesn't provide Screen Wake Lock API (in particular, Safari and Firefox don't).

Re: Show HN: Prevent your computer sleeping with just a webpage

#48

So I like this and I'm trying it out, it seemingly works OK. However, the GREEN background is very annoying. I don't need the whole webpage to be green for me to know it's on and working. I can't minimize the browser (firefox) because then it apparently doesn't work. So I'm left with a very big green screen sitting in the corner of my eye. Wondering too the effect of that in terms of screen color burnout (if that's e…

I'm confused, kinda. If you want it to be a different color just alter the color?

Lots of ways to attack that, host it yourself, change it with chrome dev tools, a bookmarklet that alters the css, user scripts for css overrides like greasemonkey popularized back in the early days of the web. Hope this helps you get the color you'd like :)

Re: Show HN: Prevent your computer sleeping with just a webpage

#49
post #37
post #31

So i get annoyed that my computer doesn't go to sleep sometimes because some website is playing a video. Is there a simple way to tell Linux/Gnome/Chrome to ignore videos and go to sleep anyway? I don't watch long videos on this computer so I hate to come back into my office and find my screen never locked because some website played a video i wasn't even watching.

Additionally, something to tell me whether my PC will go to sleep or not if left alone. OP's problem happens to me every so often that I need to make sure the PC is indeed going to sleep before heading out.

I think on Windows you can run powercfg /requests

I'm not sure about linux or Mac though

Re: Show HN: Prevent your computer sleeping with just a webpage

#50
If you absolutely want to prevent a Mac from not only going to sleep, but restarting for any reason at all (say, to install important security updates, which are usually forced on the user with no choice), there aren't many good ways. The only thing I've found that really works reliably is to open MS Word, create a new document, add some random characters to it, and then leave without ever saving. Word will prevent the OS from doing anything that would cause you to lose that unsaved document. I'm sure the MS engineers dug deep into the kernel to find something foolproof. It's a bit annoying that Apple doesn't give you a little switch like that which you could toggle to say "don't restart for any reason at all".
Post reply on HN