Chuyển đến nội dung
Skillpedia
Tự động hóa48k · #3754

anti-sleep

Skill này làm gì

Ngăn Mac của bạn tự động ngủ trong các tác vụ dài như tải xuống hoặc cập nhật. Nó giữ màn hình sáng và hệ thống luôn thức.

Khi nào nên dùng

  • ✓Trong các đợt tải xuống hoặc cập nhật kéo dài.
  • ✓Khi chạy các chương trình mất nhiều thời gian.
  • ✓Khi bạn không muốn Mac ngủ trong một khoảng thời gian cụ thể.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/anti-sleep/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/anti-sleep/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giữ Mac của tôi thức trong 3 giờ.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng lệnh có sẵn trên Mac là `caffeinate`. Bạn chỉ định khoảng thời gian giữ Mac thức, hoặc cho đến khi một tác vụ cụ thể kết thúc.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Anti-Sleep (macOS caffeinate)

When to Use

  • Use when the user wants the Mac to stay awake during a long supervised task.
  • Use when a build, download, or automation run should not be interrupted by sleep.

Keep the Mac awake using the built-in caffeinate command. No install needed.

Quick start — the standard command

caffeinate -d -i -t 7200    # full power: screen stays on + no idle sleep, for 2 hours

Duration is -t <seconds>: 2h = 7200, 7h = 25200, overnight (9h) = 32400.

Aggressiveness levels

Flags Effect
-i prevents idle system sleep only (screen may still dim/lock)
-d prevents display sleep (screen stays on)
-d -i default choice — screen on + system awake
-d -i -s adds -s: prevents sleep even on AC power semantics; -s only works when plugged in
-u -t 1 simulates user activity — wakes the display right now

Default to -d -i -t <seconds> unless the user says otherwise.

Tie to a process instead of a timer

caffeinate -d -i -w <PID>          # stays awake until that process exits (great for builds)
caffeinate -i npm run build       # wraps a command; exits when the command finishes

Run it in a visible terminal (cmux pane)

Prefer running it in the user's own terminal pane so it's visible and easy to Ctrl+C. In cmux (read the cmux skill first if interacting with panes):

cmux send --surface surface:<N> "caffeinate -d -i -t 25200\n"

Otherwise run it as a background Bash task. Never block your own foreground shell with it.

Verify and monitor

pgrep -fl caffeinate                       # is it running? shows exact flags
ps -o etime= -p <PID>                      # how long it's been running
pmset -g assertions    # inspect PreventUserIdleSystemSleep / PreventUserIdleDisplaySleep        # confirm sleep assertions are active

Gotcha: caffeinate prints nothing and holds the prompt — it looks "stuck" or like Enter wasn't pressed. It isn't stuck. Verify with pgrep, not by looking at the terminal.

Expiry: with -t it exits silently when time runs out — no notification. If the user asks "is it still on?" after hours, check pgrep first; it may simply have expired.

Keyboard backlight

caffeinate cannot keep the keyboard backlight on — it has its own inactivity timer with no CLI/API on Apple Silicon (researched 2026-07). Fix is manual, one-time: System Settings > Keyboard > "Turn keyboard backlight off after inactivity" > Never.

Stop early

kill <recorded-caffeinate-PID>    # or Ctrl+C in the pane running this task

Record the PID of the process started for this task; verify its command before stopping it. Do not stop unrelated caffeinate sessions by a broad pattern.

After starting: confirm to the user the PID, the flags, and the wall-clock time it will expire.

Limitations

  • Adapted from davidondrej/skills; verify local paths, tools, credentials, and agent features before acting.
  • For commands, remote access, scheduling, browser automation, or file-changing workflows, get explicit user approval and confirm the target environment first.
Câu hỏi thường gặp

Làm sao để biết nó đang hoạt động?

Bạn có thể kiểm tra xem lệnh `caffeinate` có đang chạy trên Mac hay không. Nó không hiển thị gì trên màn hình, nên có thể trông như không làm gì, nhưng thực tế nó vẫn đang hoạt động.

Làm sao để dừng sớm?

Nếu bạn đã khởi chạy lệnh, lệnh sẽ cung cấp một số (PID). Bạn có thể dùng số này để dừng tiến trình trước khi hết thời gian.

Nó có giữ đèn bàn phím sáng không?

Không, `caffeinate` không điều khiển đèn nền bàn phím. Bạn cần tự chỉnh cài đặt của Mac cho việc đó.

Chi tiết

Mô tả gốc của tác giả

Keep a Mac awake with caffeinate during long builds, downloads, or supervised automation runs.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3754
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự