snapshot of https://github.com/ActivityWatch/aw-watcher-afk.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
14
aw_watcher_afk/macos.py
Executable file
14
aw_watcher_afk/macos.py
Executable file
@@ -0,0 +1,14 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user