diff options
author | 2022-07-09 00:11:48 +0530 | |
---|---|---|
committer | 2022-07-09 00:11:48 +0530 | |
commit | f0e484878af5b86b723de6af5f506f8b18e66ddc (patch) | |
tree | 0e688955119acf9598a85fdcba77ce21c104b327 /src/Watcher/afk.py | |
parent | 255487a34700d6790a2771a177c16991caaca72f (diff) | |
parent | ac79bbea7b113613bf160512064b8e2478181db9 (diff) | |
download | shopno-os-log-sync-f0e484878af5b86b723de6af5f506f8b18e66ddc.tar.gz shopno-os-log-sync-f0e484878af5b86b723de6af5f506f8b18e66ddc.zip |
Update 1.2 | AFK feature | New algorithm to update log file at each second
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..e309231 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 >= 300000: # 3min no input == AFK + 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 + |