Files
upstream-aw-watcher-afk/aw_watcher_afk/macos.py
upstream-mirror 87aaa2add8
Some checks failed
Build / Test on macos-latest (py-3.9) (push) Has been cancelled
Build / Test on ubuntu-24.04 (py-3.9) (push) Has been cancelled
Build / Test on windows-latest (py-3.9) (push) Has been cancelled
CodeQL / Analyze (python) (push) Failing after 1m36s
snapshot of https://github.com/ActivityWatch/aw-watcher-afk.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:21:02 +05:00

15 lines
477 B
Python
Executable File

from Quartz.CoreGraphics import (CGEventSourceSecondsSinceLastEventType,
kCGEventSourceStateHIDSystemState,
kCGAnyInputEventType)
def seconds_since_last_input() -> float:
return CGEventSourceSecondsSinceLastEventType(kCGEventSourceStateHIDSystemState, kCGAnyInputEventType)
if __name__ == "__main__":
from time import sleep
while True:
sleep(1)
print(seconds_since_last_input())