diff options
author | 2022-07-18 16:41:53 +0530 | |
---|---|---|
committer | 2022-07-18 16:41:53 +0530 | |
commit | fbe30df91fd15dd52c31a1237c9a00c24763f509 (patch) | |
tree | 189446929df9dec5b11e72f0a0e7c8a1ed7f6956 /src | |
parent | c927f1f3694b90573373e07230730ec9b8e6a18c (diff) | |
download | shopno-os-log-sync-fbe30df91fd15dd52c31a1237c9a00c24763f509.tar.gz shopno-os-log-sync-fbe30df91fd15dd52c31a1237c9a00c24763f509.zip |
adding -s option to start watch_log function | active_window function updated to reduce error to get home-screen
Diffstat (limited to 'src')
-rwxr-xr-x | src/Watcher/get_windows.py | 7 | ||||
-rw-r--r-- | src/bin/watcher | 2 |
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": |