frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Adrafinil – keep a lid-closed Mac awake only while agents work

https://github.com/kageroumado/adrafinil
37•kageroumado•1h ago
A month ago there was a wave of posts and tweets about engineers walking around cafes and parks with their MacBooks propped half-open, as fully closing the lid forces sleep that stops their AI agents. Some people made snarky comments about using tmux or Amphetamine, and some defended their choice with “but I only need it sometimes, and forgetting to disable Amphetamine and finding my laptop discharged in my bag is worse.”

This is a solution to this problem. Unlike caffeinate, it will prevent your MacBook from sleeping even with the lid closed, with no external power or display, using pmset disablesleep 1. Unlike other sleep-preventing apps, Adrafinil only activates when there’s an agent actively doing something. It detects agent activity through hooks it installs into Claude Code, Codex, and others. To reassure you it’s working, the app shows the active status in the menu bar, and it plays a chime when you close the lid.

Once the agent is done, Adrafinil detects it and lets the laptop go to sleep by setting pmset disablesleep back to 0. It will also let it sleep in case of overheating. And if you want to manually toggle it, you can install an optional MCP and tell your agent to keep the MacBook awake for a specific time.

It has four binaries, one of which is a root helper exposing a single setSleepBlocked call. All the logic and policy live in the unprivileged parts. They’re all notarized, and the app is fully open source (MIT).

Comments

processunknown•1h ago
Does it also make my Mac irritable?
kageroumado•55m ago
Probably less irritable than amphetamine~
moralestapia•1h ago
What's old is new again, but I welcome this.

I used to do this 15 years ago to keep listening to music from my laptop (one of the white chiclet ones) in my backpack, can't remember the name of the app I used then.

One caveat, your laptop cannot cool inside a backpack, it will overheat and shut down anyway. This happened to me several times.

dominotw•1h ago
had a coworkers whose laptop keys melted into mush
dmd•1h ago
that was true of intel but definitely not of arm macbooks.
NewJazz•1h ago
Then why do they have fans?
kageroumado•57m ago
It has a setting for thermal cutoff that you can set to something like 60º C. Sleeping will stop heavy work (like a build) before it leads to overheating.
xlii•1h ago
Um so it is

    sudo bash -c 'touch KEEP_RUNNING; pmset -b sleep 0; pmset -b disablesleep 1; while [ -e KEEP_RUNNING ]; do sleep 1; done; pmset -b sleep 5; pmset -b disablesleep 0'
and

    Agent, when you're done do `rm KEEP_RUNNING`, kthxbye.
?

(personally I have Ruby scripts that check activity on "tmux capture-output" for that)

fragmede•44m ago
https://news.ycombinator.com/item?id=9224
da_grift_shift•33m ago
Yeah, I'll stick with the oneliner.

https://ghloc.vercel.app/kageroumado/adrafinil?branch=main

operatingthetan•1h ago
So now we're naming apps after obscure Modafinil derivatives?
unacorner•9m ago
Adrafinil's discovery and use predates Modafinil, I believe.
chopete3•1h ago
This is great. Will check it.

Recently I bought a usb-c empty external monitor card to prevent mac from going to sleep. There are many of these external monitor simulators on Amazon.

I still see the laptop go to sleep many times with the external monitor simulator.

This is the one I bought.

4K 60Hz USB-C Type-C Virtual Display Adapter DDC EDID Dummy Plug Headless Ghost Display Emulator 2K 60hz1080P@120Hz

bluedino•44m ago
Can't you just use a hot corner configured as "prevent sleep"?
fragmede•42m ago
How does it sleep when the agent is done working with the hot corner?
doubled112•36m ago
Have the agent write an app that moves the cursor our of the hot corner and trigger it when done.
kageroumado•21m ago
The dummy display enables “clamshell mode,” which lets your MacBook stay awake even with the lid closed, provided that it’s also on AC power. If the MacBook is not connected to power, the clamshell mode isn’t activated and it will sleep normally.

Adrafinil simply disables the global sleep without spoofing hardware, and re-enables it once the agent is done working, the temperature is too high, or the battery is low.

dawnerd•59m ago
But Amphetamine has an option to end when an app closes. I’m just so confused why everyone using ai is reinventing solutions that already exist.
conception•51m ago
Easier to ask Claude than ask google I guess.
kageroumado•51m ago
Claude Code or Codex (normally) don’t close the terminal window after a turn ends, they wait for the user’s reply.
flexagoon•35m ago
Everyone dreams about making the next cool AI tool and doesn't bother checking if someone has already made the same thing years ago without the word "AI" in the description
neoecos•28m ago
I think the same...It happend to me that I just ask Claude to build whatever I need for my personal very specific use case without looking what else it's outhere
cyclopeanutopia•54m ago
Ridiculous bloat.
WUMBOWUMBO•53m ago
reminds me of ye old caffeinate
kageroumado•36m ago
Caffeinate doesn’t prevent sleep with the lid closed.
aqme28•40m ago
Thank goodness. I can’t leave my laptop for a second unattended because my cat loves nothing more than to dance on the keyboard. I’ve need something like this.
rancar2•40m ago
For MacOS, keep awake with:

sudo pmset -a disablesleep 1

Reset back:

sudo pmset -a disablesleep 0

kageroumado•33m ago
This is exactly what the app does, except it ties it to agent activity and re-enables sleep once the turn ends, the laptop is close to overheating, the battery is low, or on a timer.
xbar•30m ago
Nice. I needed this yesterday, and will need it again today.
cyanydeez•22m ago
you can run opencode inside a docker container and expose it's webui.

Show HN: Adrafinil – keep a lid-closed Mac awake only while agents work

https://github.com/kageroumado/adrafinil
39•kageroumado•1h ago•31 comments

Show HN: Smart model routing directly in Claude, Codex and Cursor

https://github.com/workweave/router
198•adchurch•1d ago•108 comments

Show HN: Hacker News on a train station-style flip board

https://popflame.quickish.space/hn-flipboard/
97•PaybackTony•21h ago•20 comments

Show HN: DBOSify – Drop-in Temporal replacement built on Postgres

https://github.com/dbos-inc/dbosify-py
81•KraftyOne•3d ago•18 comments

Show HN: Wind particles on Mapbox from a single EXIF JPEG

https://www.us-wind-particle-map-demo.mapbox-exif-layer.com
3•zifanw9•4h ago•0 comments

Show HN: A Living Neural Web in HTML5 Canvas

https://techoreon.github.io/verpad/canvas-playground.html
5•guptalog•5h ago•3 comments

Show HN: WebBase-III – dBASE III rebuilt in the browser with its own interpreter

https://github.com/DDecoene/WebBaseIII
94•ddecoene•3d ago•27 comments

Show HN: Autofit2 – End-to-end pipeline for multilingual text classification

https://github.com/neospe/autofit2
27•leschak•2d ago•2 comments

Show HN:I got tired of spending 3hrs daily on job applications,so I automated it

https://jobspire.co.in/
4•cbyteai•6h ago•2 comments

Show HN: Turn images into audio that can be decoded with a spectrogram

https://nsspot.herokuapp.com/imagetoaudio/
9•jupr•3d ago•4 comments

Show HN: The TypeScript Semantic Layer for ClickHouse

https://github.com/hypequery/hypequery
5•lureilly1•12h ago•4 comments

Show HN: I made Google Trends for Hacker News by indexing 18 years of comments

https://hackernewstrends.com
793•ytkimirti•2d ago•153 comments

Show HN: Aerial-autonomy-stack – open-source perception-based drone swarms

https://github.com/JacopoPan/aerial-autonomy-stack
3•SufficientFix42•9h ago•0 comments

Show HN: Overfitted a 900KB Transformer to Compress a 100MB CSV into 7MB

108•spidy__•4d ago•65 comments

Show HN: Turn native language audio into flashcards and shadowing practice

https://lingochunk.com/try
90•alder•2d ago•36 comments

Show HN: OpenKnowledge – open source AI-first alternative to Obsidian/Notion

https://github.com/inkeep/open-knowledge
372•engomez•2d ago•170 comments

Show HN: Open Tag, the open source Claude Tag

https://github.com/CopilotKit/OpenTag
4•nathan_tarbert•10h ago•0 comments

Show HN: Play puzzle games in a feed like TikTok

https://puzzle.express
6•trancence•12h ago•4 comments

Show HN: Bible as RAG Database

https://www.crosscanon.com/
158•jacksonastone•2d ago•91 comments

Show HN: Nub – A Bun-like all-in-one toolkit for Node.js

https://github.com/nubjs/nub
274•colinmcd•3d ago•80 comments

Show HN: Wordit – Change One Letter, Keep the Chain Going

https://victorribeiro.com/wordit/
43•atum47•4d ago•30 comments

Show HN: peerd – AI agent harness that runs entirely in your browser

https://github.com/NotASithLord/peerd
74•NotASithLord•4d ago•23 comments

Show HN: LookAway, a Mac break reminder that knows when not to interrupt

https://lookaway.com
74•_kush•3d ago•25 comments

Show HN: Nimic – Pure Python as a systems language with AOT compilation

https://github.com/dima-quant/nimic
42•dima-quant•4d ago•28 comments

Show HN: TikZ Editor – WYSIWYG editor for figures in LaTeX

https://tikz.dev/editor/
449•DominikPeters•4d ago•74 comments

Show HN: Secs-man, a secrets manager you can (not) rely on

https://github.com/Fran314/secrets-manager-rs
30•Fran314•2d ago•19 comments

Show HN: Neural Particle Automata

https://selforg-npa.github.io/
88•esychology•4d ago•19 comments

Show HN: Jargo – a Golang port of Pipecat for conversational-AI apps

https://github.com/gojargo/jargo
5•fallais•1d ago•0 comments

Show HN: I Derived a Steak

https://www.absurdlyoptimized.com/recipes/grilled-meats/
8•bkazez•1d ago•1 comments

Show HN: Mantis, A self-hosted LLM gateway

https://github.com/mantis-llm-gateway
5•rizsyed1•1d ago•0 comments