aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/afk.py
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-09 00:11:48 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-09 00:11:48 +0530
commitf0e484878af5b86b723de6af5f506f8b18e66ddc (patch)
tree0e688955119acf9598a85fdcba77ce21c104b327 /src/Watcher/afk.py
parent255487a34700d6790a2771a177c16991caaca72f (diff)
parentac79bbea7b113613bf160512064b8e2478181db9 (diff)
downloadshopno-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-xsrc/Watcher/afk.py14
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
+