-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrigger.py
More file actions
32 lines (23 loc) · 969 Bytes
/
Copy pathtrigger.py
File metadata and controls
32 lines (23 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Start the daemon only when an agent app is actually open.
Run periodically by the scheduled task the installer creates (Windows
Task Scheduler / macOS launchd StartInterval) -- NOT at login. Checks
for watched agent processes or fresh agent file activity and brings the
daemon up via lightctl.ensure_daemon(); exits immediately otherwise, so
nothing stays resident while no agent is around.
Hooked agents (Claude Code, Cursor, Codex notify) still start the daemon
instantly through their hooks; this trigger only covers hook-less apps
(the Codex/ChatGPT app, Gemini, opencode, ...), with a worst-case delay
of one trigger interval.
"""
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE))
import lightctl # noqa: E402
import watchers # noqa: E402
def main():
if watchers.poll() or watchers.procs_alive():
lightctl.ensure_daemon()
return 0
if __name__ == "__main__":
sys.exit(main())