Mercurial > code > home > repos > racc
view collector/idle_osx.py @ 8:af6e0049e701
deploy for vite
author | drewp@bigasterisk.com |
---|---|
date | Mon, 13 Mar 2023 18:54:47 -0700 |
parents | 5ad799e534a5 |
children |
line wrap: on
line source
import subprocess def get_idle_seconds(): for line in subprocess.check_output(['ioreg', '-c', 'IOHIDSystem'], encoding='ascii').splitlines(): if 'HIDIdleTime' in line: ns = float(line.split(' = ')[1]) return (ns / 1000000000) raise ValueError("idle time not found")