This commit is contained in:
2026-07-07 22:43:49 -07:00
parent 066429b3af
commit ba1c35a462
9 changed files with 123 additions and 30 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
import json
import shutil
import subprocess
import sys
def main() -> int:
if len(sys.argv) != 2:
return 0
try:
event = json.loads(sys.argv[1])
except json.JSONDecodeError:
return 0
if event.get("type") != "agent-turn-complete":
return 0
notify_send = shutil.which("notify-send")
if notify_send is None:
return 0
message = event.get("last-assistant-message") or "Request completed"
message = " ".join(str(message).split())
if len(message) > 180:
message = message[:177] + "..."
subprocess.run(
[notify_send, "--app-name=Codex", "Codex", message],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=False,
)
return 0
if __name__ == "__main__":
raise SystemExit(main())