Earlier quoted context omitted.
> 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` :)
Show HN: Prevent your computer sleeping with just a webpage
51–60 of 137 posts
Re: Show HN: Prevent your computer sleeping with just a webpage
#52If 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 t…
https://developer.mozilla.org/en-US/docs/Web/API/Window/befo...
Re: Show HN: Prevent your computer sleeping with just a webpage
#53So 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.
Re: Show HN: Prevent your computer sleeping with just a webpage
#54If 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 t…
[0]: https://apps.apple.com/us/app/amphetamine/id937984704?mt=12
Re: Show HN: Prevent your computer sleeping with just a webpage
#55Re: Show HN: Prevent your computer sleeping with just a webpage
#56that's a pretty steep cost to pay to simply keep a computer awake because the browser it's using doesn't support a 'stay-awake api'.
Re: Show HN: Prevent your computer sleeping with just a webpage
#57Re: Show HN: Prevent your computer sleeping with just a webpage
#58Re: Show HN: Prevent your computer sleeping with just a webpage
#59On 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.
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.
You can tell caffeinate to watch for other processes too, to make sure a browser thread doing a download will finished uninterrupted before sleeping.
Re: Show HN: Prevent your computer sleeping with just a webpage
#60My workstation will certainly not be prevented from entering sleep by anything a webpage can do.