Skip to content

Commit

Permalink
added #154
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Jan 17, 2025
1 parent 0b64057 commit d6f04d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions pyprland/plugins/scratchpads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,19 @@ 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 = tuple(
int(m / monitor["scale"]) for m in ([monitor["height"], monitor["width"]] if rotated else [monitor["width"], monitor["height"]])
)
win_position = apply_offset((monitor["x"], monitor["y"]), scratch.meta.extra_positions[scratch.address])
win_size = convert_coords(scratch.conf.get("size"), monitor)
scaled = []

mon_size = [monitor["height"], monitor["width"]] if rotated else [monitor["width"], monitor["height"]]
if get_animation_type(scratch) in ("fromtop", "fromleft"):
for v1, v2 in zip(win_position, win_size, strict=True):
scaled.append(v1 + v2)
else:
scaled = [m - w for m, w in zip(mon_size, win_position, strict=True)]

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)

async def _hide_transition(self, scratch: Scratch, monitor: MonitorInfo) -> bool:
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-11"
VERSION = "2.4.3-12"

0 comments on commit d6f04d1

Please sign in to comment.