Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Feb 1, 2024
1 parent ffd4008 commit 104da35
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pyprland/plugins/layout_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,8 @@ async def _run_changefocus(self, direction, default_override=None):
if self.enabled:
clients = await self.get_clients()
if await self._sanity_check(clients):
index = 0
for i, client in enumerate(clients):
if client["address"] == self.main_window_addr:
index = i + direction
break
addresses = [c["address"] for c in clients]
index = addresses.index(self.main_window_addr) + direction
if index < 0:
index = len(clients) - 1
elif index == len(clients):
Expand Down

0 comments on commit 104da35

Please sign in to comment.