本文へ移動
Capsomnia
GitHub
Capsomnia LED icon

Macの最も無駄なキー
最高の仕事を与える

Caps Lock becomes a physical keep-awake switch. Flip it on, close the lid, and let your background work keep running.

macOS 14 Sonoma+ · Swift 6

Caps Lock on

Runs pmset -a disablesleep 1 — sleep is disabled.

Caps Lock off

Runs pmset -a disablesleep 0 — normal sleep behavior.

One switch for closed-lid work

When a long-running local job should keep going while you step away, flip Caps Lock on. Close the lid. Capsomnia keeps the machine awake until you flip it back.

Why not caffeinate?

caffeinate は、Macを開いているときのアイドルスリープ防止には便利です。しかし、蓋を閉じれば実行中のプロセスは通常停止してしまいます。

Capsomniaは pmset -a disablesleep 1 を使い、システムスリープそのものを無効化します。蓋を閉じてもローカル作業を続けられ、Caps LockのLEDがその状態を示すため画面を汚しません。

caffeinate Blocks idle sleep · lid open
Capsomnia Disables system sleep · lid closed

Install from source

Capsomnia is distributed as source for now. The install script builds Capsomnia.app locally and sets everything up.

git clone https://github.com/fuji-mak/Capsomnia.git
cd Capsomnia
./scripts/install.sh
  1. Capsomnia.app をローカルでビルドします。
  2. アプリを ~/Applications/ に配置します。
  3. スリープ制御用helperを配置します。
  4. helperの on/off/display-sleep だけを許可します。
  5. LaunchAgentを登録し、ログイン時に起動します。

Requires macOS 14 or later, a Swift 6 toolchain, and administrator access during installation.

Security model

The menu bar app runs as the current user — never as root. Changing system sleep settings needs elevated privileges, so Capsomnia uses one small, fixed, root-owned helper through passwordless sudo.

The app can only invoke

sudo -n /Library/PrivilegedHelperTools/capsomnia-pmset on
sudo -n /Library/PrivilegedHelperTools/capsomnia-pmset off
sudo -n /Library/PrivilegedHelperTools/capsomnia-pmset display-sleep

The sudoers rule is limited to these three exact commands.

The helper only ever runs

/usr/bin/pmset -a disablesleep 1
/usr/bin/pmset -a disablesleep 0
/usr/bin/pmset displaysleepnow

It accepts on, off, and display-sleep and nothing else.

Quitting the app, or running ./scripts/uninstall.sh, restores normal sleep behavior. Sleep-disabled closed-lid use can increase heat and battery drain — mind airflow, power, and runtime.

Links