<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>开源 on 洞见</title><link>https://111.230.53.36/tags/%E5%BC%80%E6%BA%90/</link><description>Recent content in 开源 on 洞见</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Wed, 14 Oct 2026 20:56:00 +0800</lastBuildDate><atom:link href="https://111.230.53.36/tags/%E5%BC%80%E6%BA%90/index.xml" rel="self" type="application/rss+xml"/><item><title>caffeinate 开源生态调研：让电脑保持唤醒的工具们</title><link>https://111.230.53.36/posts/caffeinate-ecosystem/</link><pubDate>Wed, 14 Oct 2026 20:56:00 +0800</pubDate><guid>https://111.230.53.36/posts/caffeinate-ecosystem/</guid><description>&lt;blockquote&gt;
&lt;p&gt;调研时间：2026-10-13；调研方式：公开网络资料检索（GitHub 仓库页、官方文档、技术博客）。
约定：Star 数据为 2026-10-13 检索当日快照；凡检索中未能确认的信息统一标注为「未核实」，不做臆测；明确区分「开源」与「免费但闭源」。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="summary摘要"&gt;Summary（摘要）&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;caffeinate 是 macOS 官方自带工具&lt;/strong&gt;（&lt;code&gt;/usr/bin/caffeinate&lt;/code&gt;，有官方 man page），通过向 IOKit 电源管理子系统申请 power assertion（&lt;code&gt;IOPMAssertionCreateWithName&lt;/code&gt; 等 API）阻止休眠。常用参数 &lt;code&gt;-d/-i/-m/-s/-u/-t/-w&lt;/code&gt;。&lt;strong&gt;它不能阻止笔记本合盖休眠&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;macOS 开源明星项目是 KeepingYouAwake&lt;/strong&gt;（~6.9k stars，MIT，活跃维护，本质是 caffeinate 的菜单栏 GUI 封装）。经典 Caffeine（Lighthead，2006）在 2018 年开源后由社区继续维护。2025–2026 年涌现出一大批&lt;strong&gt;合盖防休眠&lt;/strong&gt;开源小工具（lidless、decaf、stayawake 等），多由 AI coding agent 长任务场景驱动。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Owly（joaolourencoo/owly）：该 GitHub 地址不存在（404）&lt;/strong&gt;，无法核实；同名开源实现为 aarontaken/owly（2026 年新项目，仅 3 stars）；Mac App Store 上的 Owly（FIPLAB）是&lt;strong&gt;闭源&lt;/strong&gt;免费软件。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows&lt;/strong&gt;：开源首选 &lt;strong&gt;Microsoft PowerToys（含 Awake，MIT，~139k stars）&lt;/strong&gt;；轻量开源有 CHerSun/NoSleep（The Unlicense，269 stars）、&lt;strong&gt;stewardfurnace/caffeine-for-windows&lt;/strong&gt;（MIT，Zhorn Caffeine 的开源复刻）。任务中提到的 &amp;ldquo;Insomnia（djoslin0）&amp;ldquo;在 GitHub 上无此仓库；经典 Windows 版 Insomnia 是 djoslin 的&lt;strong&gt;免费闭源&lt;/strong&gt;小工具。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Linux&lt;/strong&gt;：caffeine-ng 的 GitHub 仓库已于 2022-11 归档，迁移至 Codeberg 后&lt;strong&gt;低活跃但未死&lt;/strong&gt;（过去一年 22 次提交，GPL-3.0）；GNOME Shell Caffeine 扩展&lt;strong&gt;活跃&lt;/strong&gt;（支持到 GNOME 50）；系统自带 &lt;code&gt;systemd-inhibit&lt;/code&gt; 是最直接的&amp;quot;Linux 版 caffeinate&amp;rdquo;；Wayland 有 Rust 写的 caddyglow/caffeinate 托盘抑制器。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;开发者库&lt;/strong&gt;：Python &lt;strong&gt;wakepy&lt;/strong&gt;（MIT，253 stars，活跃）、Rust &lt;strong&gt;keepawake&lt;/strong&gt; crate（MIT，月下载 ~2.9 万）、&lt;strong&gt;usrivastava92/wakeup&lt;/strong&gt;（MIT，Rust，参数与 caffeinate 完全兼容的跨平台 CLI，可作库用）。Go、Java 均无主流专用库（Java 有 mrrpiano02/my-caffeine-app 小项目）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;特殊场景&lt;/strong&gt;：NAS/服务器/Docker/CI 本质都是&amp;quot;宿主机防休眠&amp;rdquo;，用各平台自带方案即可（systemd-inhibit / caffeinate / PowerToys Awake），无专门开源项目；合盖场景是 macOS 开源工具的主战场。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="1-caffeinate-命令本身工作原理参数与官方文档"&gt;1. caffeinate 命令本身：工作原理、参数与官方文档&lt;/h2&gt;
&lt;h3 id="工作原理"&gt;工作原理&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;caffeinate&lt;/code&gt; 通过向系统电源管理子系统&lt;strong&gt;创建断言（create assertions）来改变系统休眠行为&lt;/strong&gt;（man page 原文：&amp;ldquo;caffeinate creates assertions to alter system sleep behavior&amp;rdquo;）。底层是 IOKit 电源管理框架的 &lt;strong&gt;power assertions&lt;/strong&gt; 机制，应用层 API 为 &lt;code&gt;IOPMAssertionCreateWithName&lt;/code&gt;（断言类型如 &lt;code&gt;PreventUserIdleSystemSleep&lt;/code&gt;、&lt;code&gt;PreventUserIdleDisplaySleep&lt;/code&gt; 等）。如果指定了 utility，断言在该工具运行期间持续；否则断言持续到 &lt;code&gt;caffeinate&lt;/code&gt; 进程退出——&lt;strong&gt;进程退出即自动释放，无需清理&lt;/strong&gt;。&lt;/p&gt;</description></item></channel></rss>