From 6b30c7f9ccff72fd0661f04cbe066653a9cc3970 Mon Sep 17 00:00:00 2001 From: augustin64 <67148092+augustin64@users.noreply.github.com> Date: Wed, 24 Aug 2022 17:00:07 +0200 Subject: [PATCH] Update get_windows.py Fix an IndexError happening when going on homescreen on GNOME desktop causing the entire program to crash. --- src/Watcher/get_windows.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py index 19e2a3a..0769eb9 100755 --- a/src/Watcher/get_windows.py +++ b/src/Watcher/get_windows.py @@ -19,7 +19,9 @@ def active_window(): if len(actv_id) == 4: active_window = "" else: - active_window = os.popen("xprop -id $(xdotool getwindowfocus) | grep CLASS ").read()[19:-1].replace('''"''', "").split(", ")[1] + active_window = os.popen("xprop -id $(xdotool getwindowfocus) | grep CLASS ").read() + if active_window != "": + active_window = active_window[19:-1].replace('''"''', "").split(", ")[1] if "XGetWindowProperty[_NET_ACTIVE_WINDOW] failed" in active_window: active_window = ""