Live data from Hacker News

Show HN: Prevent your computer sleeping with just a webpage

nosleep.page

11–20 of 137 posts

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

#11
post #7

with text file saved as .bat file ` @echo off powercfg.exe -x -monitor-timeout-ac 5 powercfg.exe -x -disk-timeout-ac 180 powercfg.exe -x -standby-timeout-ac 180 powercfg.exe -x -hibernate-timeout-ac 999 `

https://news.ycombinator.com/formatdoc

  @echo off
  powercfg.exe -x -monitor-timeout-ac 5
  powercfg.exe -x -disk-timeout-ac 180 
  powercfg.exe -x -standby-timeout-ac 180 
  powercfg.exe -x -hibernate-timeout-ac 999

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

#12

Thanks for sharing this. I've seen it on some recipe websites recently and was wondering how it worked. I would recommend making the links (eg to the Mozilla page) use a different color or underlined.

Yup, that's my bad CSS I'm afraid. https://bulma.io explicitly resets the color of tags inside a hero, so I need to figure out how to stop/override that

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

#13

This looks cool! It would be nice if there was a little more info on the page about how it works and any potential limitations. For example, does the page have to remain in the foreground? And if it does work in the background, will it still work if the browser unloads the page from memory?

Oh, 100% I need some more docs on the page: it's definitely not foolproof.

From my testing, it works even if the window is in the background somewhere but generally it stops working if you switch to a different tab within the same window.

You should get a popup though if you do something that causes the page to lose its Wake Lock (which works by listening to the release event: https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake...)

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

#14

Thanks for sharing this. I've seen it on some recipe websites recently and was wondering how it worked. I would recommend making the links (eg to the Mozilla page) use a different color or underlined.

Yup, that's my bad CSS I'm afraid. https://bulma.io explicitly resets the color of tags inside a hero, so I need to figure out how to stop/override that

One or the other or both of these

  Screen Wake Lock API

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

#15
On macOS just run `caffeinate` from the terminal (or `man caffeinate` for more info on the options).

I know OP copped to “various Caffeine/Amphetamine apps” but said they're often “overkill”. In this case I think a system-provided command is less overkill than a web page that either uses a browser API or plays an empty video.

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

#16

On macOS just run `caffeinate` from the terminal (or `man caffeinate` for more info on the options). I know OP copped to “various Caffeine/Amphetamine apps” but said they're often “overkill”. In this case I think a system-provided command is less overkill than a web page that either uses a browser API or plays an empty video.

For some reason caffeinate doesn't keep my computer awake (newish macbook pro)

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

#17

Earlier quoted context omitted.

I obviously missed the NoSleep.js at the end ... but then I wonder: what is then so special about this website?

It prevents your computer from sleeping with just a webpage. Why does it need to be more special than that?

I meant that nosleep.page is basically the example page from NoSleep.js hosted on the internet...

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

#18

Thanks for sharing this. I've seen it on some recipe websites recently and was wondering how it worked. I would recommend making the links (eg to the Mozilla page) use a different color or underlined.

Yup, that's my bad CSS I'm afraid. https://bulma.io explicitly resets the color of tags inside a hero, so I need to figure out how to stop/override that

The "bulma" way would be to add the `has-text-link` class to the tag [0], which has the benefit of matching your styles as well.

[0] https://bulma.io/documentation/helpers/color-helpers/

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

#19
post #16

On macOS just run `caffeinate` from the terminal (or `man caffeinate` for more info on the options). I know OP copped to “various Caffeine/Amphetamine apps” but said they're often “overkill”. In this case I think a system-provided command is less overkill than a web page that either uses a browser API or plays an empty video.

For some reason caffeinate doesn't keep my computer awake (newish macbook pro)

You might need `caffeinate -d` to prevent the display from sleeping.

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

#20
post #18

Earlier quoted context omitted.

Yup, that's my bad CSS I'm afraid. https://bulma.io explicitly resets the color of tags inside a hero, so I need to figure out how to stop/override that

The "bulma" way would be to add the `has-text-link` class to the tag [0], which has the benefit of matching your styles as well. [0] https://bulma.io/documentation/helpers/color-helpers/

Ah neat, yeah that's exactly what I need, thanks!
Post reply on HN