Skip to content

Commit

Permalink
tiny optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Jul 12, 2024
1 parent f345a8f commit 3b3d1bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions pyprland/plugins/scratchpads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,14 +760,10 @@ async def _handle_focus_tracking(self, scratch: Scratch, active_window: str, act
if tracker and not tracker.prev_focused_window_wrkspc.startswith("special:"):
same_workspace = tracker.prev_focused_window_wrkspc == active_workspace
clients = await self.hyprctl_json("clients")
client = next(filter(lambda d: d.get("address") == tracker.prev_focused_window, clients), {})
if (
scratch.have_address(active_window)
and same_workspace
and not scratch.have_address(tracker.prev_focused_window)
and not client.get("workspace", {}).get("name", "").startswith("special")
):
await self.hyprctl(f"focuswindow address:{tracker.prev_focused_window}")
if scratch.have_address(active_window) and same_workspace and not scratch.have_address(tracker.prev_focused_window):
client: ClientInfo | dict = next(filter(lambda d: d.get("address") == tracker.prev_focused_window, clients), {})
if not client.get("workspace", {}).get("name", "").startswith("special"):
await self.hyprctl(f"focuswindow address:{tracker.prev_focused_window}")

# }}}

Expand Down
2 changes: 1 addition & 1 deletion pyprland/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version."""

VERSION = "2.4.0-8"
VERSION = "2.4.0-28"

0 comments on commit 3b3d1bc

Please sign in to comment.