heimdallur
Keep your machine awake while long tasks or agents run. A thin, dependency-free
wrapper around caffeinate (macOS) and systemd-inhibit (Linux), exposed as
both a Python library and a CLI.
Install
pip install heimdallur
Library
from heimdallur import StayAwake
with StayAwake(display=False, lid=False):
run_long_task()
# or explicit control
guard = StayAwake()
guard.start()
try:
run_long_task()
finally:
guard.stop()
The guard rolls back automatically on __exit__, stop(), and via an
atexit hook even if the process crashes.
CLI
heimdallur # stay awake until Ctrl+C
heimdallur -- make build # stay awake while the command runs
heimdallur -w 12345 # stay awake while PID 12345 is alive
Flags:
-d,--display— also keep the display awake.--lid— prevent sleep even with the lid closed.
Auto-mode (Cursor Hooks)
Install once and heimdallur will start automatically at the beginning of every Cursor agent session — no skill trigger needed:
pip install heimdallur
heimdallur --install-hooks
This writes a sessionStart hook entry into ~/.cursor/hooks.json (merging
into any existing config without touching other hooks) and places the companion
script at ~/.cursor/hooks/heimdallur-session.sh.
To remove the hooks:
heimdallur --uninstall-hooks
Note:
--install-hooksmodifies~/.cursor/hooks.jsonat the user level (not project level). If Cursor is not installed, the command will exit with an error.
⚠️ Warning about --lid
On macOS --lid runs sudo pmset -a disablesleep 1, which means the system
will never sleep until it is rolled back to 0. heimdallur rolls this back
automatically on exit, but:
- It requires
sudo, which may hang on a password prompt in non-interactive (agent) contexts — avoid it there. - If the process is killed with
SIGKILL, rollback cannot run. Re-runsudo pmset -a disablesleep 0manually if needed.
License
MIT
Metadata
Release files for heimdallur 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| heimdallur-0.2.1.tar.gz | 10.1 kB | With provenance | Details for heimdallur-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heimdallur-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for heimdallur-0.2.1-py3-none-any.whl |
Total release size: 18.6 kB
Release files / heimdallur-0.2.1.tar.gz
| Download URL | heimdallur-0.2.1.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2ede6802649c32769589178b91538126e1f45aa738f733e8fda4e2edb4f7373
|
|
BLAKE2b-256 checksum How to use checksums |
9836dde3fe766a268d7700db2ead6af35d5dfa01f1cb2942f1f2101f0fc9645d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logRelease files / heimdallur-0.2.1-py3-none-any.whl
| Download URL | heimdallur-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f90ca74c168e75236c874b4efedf329de87a3284b3c0d998bb9d77af00524a0a
|
|
BLAKE2b-256 checksum How to use checksums |
b48fd471674e890e1715406c894b6a18a9c040fa51e2896dac860a52f022abac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logSecurity for heimdallur 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for heimdallur-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.