Created
October 13, 2018 00:12
-
-
Save Lvl4Sword/ed695203a4355c2096d44d70ae028e36 to your computer and use it in GitHub Desktop.
Detect idle time, because why not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import time | |
while True: | |
time.sleep(1) | |
a = subprocess.check_output('xprintidle') | |
a = round(int(a.decode().strip()), -3) | |
print('Seconds idle: {0}'.format(int(a / 1000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment