aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/get_windows.py
diff options
context:
space:
mode:
authorLibravatar Vaishnav Deore <[email protected]>2022-11-14 20:18:17 +0530
committerLibravatar GitHub <[email protected]>2022-11-14 20:18:17 +0530
commit20fd09803001a7e6371360afedb3091dd9242d07 (patch)
tree3b46618374f8c6bb4dec0682ecdd65176a1c260c /src/Watcher/get_windows.py
parentca1d6e1cacb4b5e3106f556f99687bc3df5af86b (diff)
parent212a5aaf5c1b2b2b956d75c4ba66c95222e31683 (diff)
downloadshopno-os-log-sync-20fd09803001a7e6371360afedb3091dd9242d07.tar.gz
shopno-os-log-sync-20fd09803001a7e6371360afedb3091dd9242d07.zip
Merge pull request #38 from Waishnav/v2.0
v2.0 ready to use
Diffstat (limited to '')
-rwxr-xr-xsrc/Watcher/get_windows.py28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py
index 0769eb9..a0be469 100755
--- a/src/Watcher/get_windows.py
+++ b/src/Watcher/get_windows.py
@@ -1,6 +1,4 @@
import os
-import time
-from afk import get_afk_status
# get title name of app that user working on
def active_window_title():
@@ -42,26 +40,10 @@ def active_window():
return active_window
# returns true if user has move to next app which is not the same as previous
-def is_window_changed(a, afk, timeout):
- result = False
- while not(result):
- time.sleep(0.5)
- b = active_window()
- if a != b :
- result = True
- elif get_afk_status(afk, timeout):
- result = True
- else:
- result = False
- return result
+def previous_window(array_of_window, active_window):
+ array_of_window.remove(active_window)
+ array_of_window.append(active_window)
+ return array_of_window[-2]
-
-### what to do after window get change I've to append one line in csv data file in following format
-### opened-time closed-time time-spent window_class_name window_title_name
-
-### and whenever the user puts particular command it will make report till the time for that day and shows that report in terminal
if __name__ == "__main__":
- while True:
- time.sleep(1)
- print(active_window_title())
- print(os.popen('''xdotool getwindowfocus getwindowname''').read())
+ print(active_window())