diff options
Diffstat (limited to 'src/Watcher/afk.py')
-rwxr-xr-x | src/Watcher/afk.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Watcher/afk.py b/src/Watcher/afk.py index e69de29..2c54888 100755 --- a/src/Watcher/afk.py +++ b/src/Watcher/afk.py @@ -0,0 +1,14 @@ +import os +def IsAFK(): + time_since_last_input = int(os.popen("xprintidle").read()) + if time_since_last_input >= 3000: + video_playback = os.popen("""pacmd list-sink-inputs | grep -w state | grep -i 'CORKED'""").read() + # if playback is not running as well as user is AFK + if "CORKED" in video_playback: + return True + # if playback is running is background as well as user is AFK + else: + return False + else: + return False + |