aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/afk.py
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 20:23:17 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 20:23:17 +0530
commit471d0b43e3fa2f5f077ce9ad4824992058d26e0e (patch)
treed262855355d683074c21bb39f196e98e4d26cc94 /src/Watcher/afk.py
parentaf16350b30a9f02974ddc880ee51bf475cb150f8 (diff)
downloadshopno-os-log-sync-471d0b43e3fa2f5f077ce9ad4824992058d26e0e.tar.gz
shopno-os-log-sync-471d0b43e3fa2f5f077ce9ad4824992058d26e0e.zip
updating log file algorithm | added AFK feature | changing dependency xdotool to ewmh
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..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
+