diff --git a/ipc-scripts/trailfocus.py b/ipc-scripts/trailfocus.py index 28eec65..487dda0 100755 --- a/ipc-scripts/trailfocus.py +++ b/ipc-scripts/trailfocus.py @@ -9,30 +9,15 @@ commands_sock = WayfireSocket(addr) commands_sock.watch() -outputs = [] - -def output_realized(output): - for o in outputs: - if output == o: - return True - return False - def sort_views(): try: views = commands_sock.list_views() - outputs.clear() - for v in views: - if v["role"] == "desktop-environment": - continue - if "parent" in v and v["state"]["minimized"]: - continue - if not output_realized(v["output"]): - outputs.append(v["output"]) + outputs = commands_sock.list_outputs() for o in outputs: i = 0 timestamps = [] for v in views: - if v["output"] != o or v["role"] == "desktop-environment": + if v["output"] != o["name"] or v["role"] == "desktop-environment": continue if "parent" in v and v["state"]["minimized"]: continue @@ -53,7 +38,7 @@ def sort_views(): for v in views: if t != v["last-focus-timestamp"]: continue - if v["output"] != o or v["role"] == "desktop-environment": + if v["output"] != o["name"] or v["role"] == "desktop-environment": break if "parent" in v and v["state"]["minimized"]: break diff --git a/ipc-scripts/wayfire_socket.py b/ipc-scripts/wayfire_socket.py index 13cd008..d82c9d8 100644 --- a/ipc-scripts/wayfire_socket.py +++ b/ipc-scripts/wayfire_socket.py @@ -44,6 +44,10 @@ def list_views(self): message = get_msg_template("window-rules/list-views") return self.send_json(message) + def list_outputs(self): + message = get_msg_template("window-rules/list-outputs") + return self.send_json(message) + def set_view_opacity(self, view_id: int, opacity: float, duration: int): message = get_msg_template("wf/obs/set-view-opacity") message["data"] = {}