From 471d0b43e3fa2f5f077ce9ad4824992058d26e0e Mon Sep 17 00:00:00 2001 From: Waishnav Date: Fri, 8 Jul 2022 20:23:17 +0530 Subject: updating log file algorithm | added AFK feature | changing dependency xdotool to ewmh --- src/Watcher/afk.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Watcher/afk.py') 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 + -- cgit v1.2.3