aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/Watcher/get_windows.py7
-rw-r--r--src/bin/watcher2
2 files changed, 6 insertions, 3 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
diff --git a/src/bin/watcher b/src/bin/watcher
index 4bea832..f9d291c 100644
--- a/src/bin/watcher
+++ b/src/bin/watcher
@@ -27,7 +27,7 @@ try:
cmd.week_summary()
elif arg == "-h" or arg == "--help":
help_option()
- elif arg == "--start":
+ elif arg == "--start" or arg == "-s":
print("Log creations started... \nif you wanna stop it, use keyboard-shortcut (Ctrl+Shift+C or Ctrl+C)")
x.log_creation()
elif arg == "--version":