Skip to content

Commit

Permalink
ipc-scripts: Use new list-outputs() to get output list
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau committed Nov 26, 2023
1 parent 8f9a1fb commit 2c05a09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
21 changes: 3 additions & 18 deletions ipc-scripts/trailfocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions ipc-scripts/wayfire_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = {}
Expand Down

0 comments on commit 2c05a09

Please sign in to comment.