aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xsrc/Watcher/get_windows.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5197f23..353c5a3 100644
--- a/README.md
+++ b/README.md
@@ -36,5 +36,5 @@ $ chmod +x ./install && ./install
```
## To-do
-- [ ] AFK feature
+- [x] AFK feature
- [ ] GUI only if got 300 stars Probably [Tauri App](https://github.com/tauri-apps/tauri).
diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py
index 65e8a93..85e9bd8 100755
--- a/src/Watcher/get_windows.py
+++ b/src/Watcher/get_windows.py
@@ -14,7 +14,7 @@ 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 | awk '{print $4}'").read()[:-1].replace('''"''', "")
+ active_window = os.popen("xprop -id $(xdotool getactivewindow) | grep CLASS ").read()[19:-1].replace('''"''', "").split(", ")[0]
if "XGetWindowProperty[_NET_ACTIVE_WINDOW] failed" in active_window:
active_window = ""
@@ -49,6 +49,7 @@ 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