Skip to content

Commit

Permalink
simpler automatic offset computation
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Jan 28, 2025
1 parent c732564 commit 4a2f0d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions pyprland/plugins/scratchpads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,10 @@ async def get_offsets(self, scratch: Scratch, monitor: MonitorInfo | None = None
if offset:
return cast(tuple[int, int], (convert_monitor_dimension(offset, ref, monitor) for ref in aspect))

# compute from client size & margin
margin = scratch.conf.get("margin", DEFAULT_MARGIN)

mon_size = [monitor["height"], monitor["width"]] if rotated else [monitor["width"], monitor["height"]]

margins = [convert_monitor_dimension(margin, dim, monitor) for dim in mon_size]
scaled = map(int, [(a + m) / monitor["scale"] for a, m in zip(aspect, margins, strict=False)])
return cast(tuple[int, int], scaled)
offsets = [convert_monitor_dimension("100%", dim, monitor) for dim in mon_size]
return cast(tuple[int, int], offsets)

async def _hide_transition(self, scratch: Scratch, monitor: MonitorInfo) -> bool:
"""Animate hiding a scratchpad."""
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.3-15"
VERSION = "2.4.3-16"

0 comments on commit 4a2f0d4

Please sign in to comment.