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
40•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•1h 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•1h 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•52m ago
https://news.ycombinator.com/item?id=9224
da_grift_shift•41m 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•17m ago
Adrafinil's discovery and use predates Modafinil, I believe.
operatingthetan•9m ago
I admire your pharma knowledge.
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•52m ago
Can't you just use a hot corner configured as "prevent sleep"?
fragmede•51m ago
How does it sleep when the agent is done working with the hot corner?
doubled112•44m ago
Have the agent write an app that moves the cursor our of the hot corner and trigger it when done.
kageroumado•30m 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•1h 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•59m ago
Easier to ask Claude than ask google I guess.
kageroumado•59m ago
Claude Code or Codex (normally) don’t close the terminal window after a turn ends, they wait for the user’s reply.
flexagoon•43m 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•36m 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•1h ago
Ridiculous bloat.
WUMBOWUMBO•1h ago
reminds me of ye old caffeinate
kageroumado•44m ago
Caffeinate doesn’t prevent sleep with the lid closed.
aqme28•49m 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•48m ago
For MacOS, keep awake with:

sudo pmset -a disablesleep 1

Reset back:

sudo pmset -a disablesleep 0

kageroumado•41m 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•38m ago
Nice. I needed this yesterday, and will need it again today.
cyanydeez•31m ago
you can run opencode inside a docker container and expose it's webui.

IP Crawl: Living atlas of open webcams discovered on the public internet

https://ipcrawl.com/
144•arm32•3h ago•82 comments

Anonymous GitHub account mass-dropping undisclosed 0-days

https://github.com/bikini/exploitarium
567•binyu•7h ago•227 comments

OpenRA

https://www.openra.net/
511•tosh•10h ago•92 comments

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

https://github.com/kageroumado/adrafinil
40•kageroumado•1h ago•32 comments

AI learns the “dark art” of RFIC design

https://spectrum.ieee.org/ai-radio-chip-design
160•Brajeshwar•3d ago•100 comments

DSpark: Speculative decoding accelerates LLM inference [pdf]

https://github.com/deepseek-ai/DeepSpec/blob/main/DSpark_paper.pdf
705•aurenvale•13h ago•290 comments

'Careless People' author claims Meta surveilled her for 12mos to enforce silence

https://fortune.com/2026/06/26/meta-wynn-williams-surveillance-gag-order-lawsuit-2026/
96•1vuio0pswjnm7•1h ago•26 comments

Turn your site into a place people can bump into each other

https://cauenapier.com/blog/townsquare_release/
111•eustoria•5h ago•58 comments

Fintech Engineering Handbook

https://w.pitula.me/fintech-engineering-handbook/
426•signa11•11h ago•144 comments

Paradise Revisited: What Darwin Saw in the Galápagos

https://www.theatlantic.com/magazine/2026/08/writers-way-galapagos-charles-darwin-travel/687480/
19•benbreen•3d ago•0 comments

Suspicious Discontinuities (2020)

https://danluu.com/discontinuities/
188•tosh•8h ago•43 comments

The case for physical media ownership

https://dervis.de/physical/
326•cemdervis•10h ago•216 comments

Post-Mythos Cybersecurity: Keep calm and carry on

https://cephalosec.com/blog/cybersecurity-in-the-post-mythos-era-keep-calm-and-carry-on/
119•Versipelle•8h ago•35 comments

GLP-1 drugs led to weight loss and reversed depression-like behavior in mice

https://www.psychologytoday.com/au/blog/mood-by-microbe/202606/what-ozempic-does-to-the-gut-brain...
22•randycupertino•53m ago•4 comments

Michigan spent $1.8B and only created 602 jobs

https://www.msn.com/en-us/money/general/michigan-spent-1-8-billion-and-only-created-602-jobs/ar-A...
22•littlexsparkee•42m ago•6 comments

Should European housing politics be Americanized?

https://worksinprogress.co/issue/should-european-housing-politics-be-americanized/
9•JumpCrisscross•1h ago•19 comments

Supabase (YC S20) Is Hiring for Multigres

https://jobs.ashbyhq.com/supabase/2e718684-4f75-4a99-8d6b-3b6bd44e4228
1•awalias•5h ago

Reducing tick density along recreational trails in Ottawa, Canada

https://www.sciencedirect.com/science/article/pii/S1877959X26000476
119•bushwart•3d ago•65 comments

How do you keep Web MIDI from crashing a 1983 synthesizer?

https://knob.monster/how-do-you-keep-web-midi-from-crashing-a-1983-synthesizer
4•halfradaition•3d ago•4 comments

One man, two kernels, and a lot of RISC-V

https://www.theregister.com/software/2026/06/26/one-man-two-kernels-and-a-lot-of-risc-v/5262858
65•LorenDB•1d ago•5 comments

The eerie interface of man and machine (Life Magazine, October 1967)

https://blog.jgc.org/2026/06/the-eerie-interface-of-man-and-machine.html
17•Brajeshwar•3d ago•0 comments

Asian AI startups launch Mythos-like models

https://techcrunch.com/2026/06/27/asian-ai-startups-launch-mythos-like-models-as-anthropics-expor...
94•bogdiyan•9h ago•82 comments

Running a software jam in a world of slop

https://foxmoss.com/blog/radish/
27•foxmoss•8h ago•6 comments

A History of Menus Is a Menu of History

https://pudding.cool/2026/06/menu-story/
36•surprisetalk•2d ago•6 comments

Zuckerberg's war on whistleblowers

https://pluralistic.net/2026/06/27/zuckerstreisand-2/
552•HotGarbage•7h ago•201 comments

Long Wave radio era set to end with switch-off

https://www.economist.com/britain/2026/06/25/the-bbc-switches-off-its-oldest-service
154•edward•2d ago•152 comments

How H-E-B became Texas' most beloved brand (2024)

https://texashighways.com/culture/how-heb-became-texas-most-beloved-brand/
73•NaOH•3d ago•68 comments

The US Army Issued Ocarinas to Soldiers in World War II

https://www.flutetunes.com/articles/my-flute-goes-to-war/
137•tomcam•2d ago•67 comments

How Many Elementary Particles Are There, Really?

https://www.quantamagazine.org/how-many-elementary-particles-are-there-really-20260615/
112•rwmj•9h ago•98 comments

Linux on Older Hardware: The Complete Revival Guide

https://www.fosslinux.com/158206/linux-on-older-hardware-revival-guide.htm
188•tapanjk•2d ago•109 comments