diff options
author | 2022-06-14 02:28:14 +0530 | |
---|---|---|
committer | 2022-06-14 02:28:14 +0530 | |
commit | 255487a34700d6790a2771a177c16991caaca72f (patch) | |
tree | c426f4930e1a5102e2fa69350fb7d14daa466b23 /src | |
parent | d5da5be46fb459959d64f52c310c8ab08163ae21 (diff) | |
download | shopno-os-log-sync-255487a34700d6790a2771a177c16991caaca72f.tar.gz shopno-os-log-sync-255487a34700d6790a2771a177c16991caaca72f.zip |
Ubuntu error solved of getting active window;
Diffstat (limited to 'src')
-rwxr-xr-x | src/Watcher/get_windows.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py index 6b1960f..6e7b3f2 100755 --- a/src/Watcher/get_windows.py +++ b/src/Watcher/get_windows.py @@ -1,16 +1,12 @@ import os import time -class window: - def __init__(self, class_name, title_name): - self.class_name = class_name - self.title_name = title_name - # get classname of app that user working on def active_window(): - # running bash command and storing result as a string - active_window = os.popen("xdotool getwindowfocus getwindowclassname").read() - active_window = active_window[0:-1] + # above command gives error on ubuntu cause of xdotool version is too old there while on arch it works +# active_window = os.popen("xdotool getwindowfocus getwindowclassname").read() + active_window_id = os.popen("xdotool getactivewindow").read()[:-1] + active_window = os.popen("xprop -id "+ str(active_window_id) +" | grep CLASS").read()[18::].split(",")[1].replace('''"''', "") return active_window # get title name of app that user working on |