aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/get_windows.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/Watcher/get_windows.py')
-rwxr-xr-xsrc/Watcher/get_windows.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py
index 85e9bd8..2831833 100755
--- a/src/Watcher/get_windows.py
+++ b/src/Watcher/get_windows.py
@@ -14,7 +14,11 @@ def active_window_title():
# get classname of app that user working on
def active_window():
- active_window = os.popen("xprop -id $(xdotool getactivewindow) | grep CLASS ").read()[19:-1].replace('''"''', "").split(", ")[0]
+ actv_id = os.popen("xdotool getwindowfocus").read()[:-1]
+ if len(actv_id) == 4:
+ active_window = ""
+ else:
+ active_window = os.popen("xprop -id $(xdotool getwindowfocus) | grep CLASS ").read()[19:-1].replace('''"''', "").split(", ")[1]
if "XGetWindowProperty[_NET_ACTIVE_WINDOW] failed" in active_window:
active_window = ""
@@ -49,7 +53,6 @@ def is_window_changed(a, afk, timeout):
return result
-print(active_window())
### 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