Skip to content

Commit b99b3d4

Browse files
committed
use shared constant for minimal sleep values
1 parent 89e198a commit b99b3d4

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

pyprland/plugins/scratchpads/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ...common import MINIMUM_FULL_ADDR_LEN, is_rotated
1111
from ...models import ClientInfo, Environment, ReloadReason, VersionInfo
1212
from ..interface import Plugin
13-
from .common import FocusTracker, HideFlavors
13+
from .common import ONE_FRAME, FocusTracker, HideFlavors
1414
from .events import EventsMixin
1515
from .helpers import (
1616
compute_offset,
@@ -521,13 +521,13 @@ async def _hide_scratch(self, scratch: Scratch, active_window: str, active_works
521521

522522
for addr in scratch.extra_addr:
523523
await self.backend.close_window(addr)
524-
await asyncio.sleep(0.01)
524+
await asyncio.sleep(ONE_FRAME)
525525
else:
526526
await self.backend.move_window_to_workspace(scratch.full_address, mk_scratch_name(scratch.uid), silent=True)
527527

528528
for addr in scratch.extra_addr:
529529
await self.backend.move_window_to_workspace(addr, mk_scratch_name(scratch.uid), silent=True)
530-
await asyncio.sleep(0.01)
530+
await asyncio.sleep(ONE_FRAME)
531531

532532
await self._hide_transition(scratch, monitor_info)
533533

pyprland/plugins/scratchpads/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from dataclasses import dataclass
44
from enum import Flag, auto
55

6+
ONE_FRAME = 1 / 50 # minimum delay to let the backend process commands
7+
68

79
class HideFlavors(Flag):
810
"""Flags for different hide behavior."""

pyprland/plugins/scratchpads/transitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ...adapters.units import convert_coords, convert_monitor_dimension
1010
from ...common import is_rotated
1111
from .animations import AnimationTarget, Placement
12-
from .common import FocusTracker
12+
from .common import ONE_FRAME, FocusTracker
1313
from .helpers import apply_offset, mk_scratch_name
1414

1515
if TYPE_CHECKING:
@@ -184,7 +184,7 @@ async def _show_transition(self, scratch: Scratch, monitor: MonitorInfo, was_ali
184184
f"movewindowpixel exact {off_x} {off_y},address:{scratch.full_address}",
185185
]
186186
)
187-
await asyncio.sleep(0.01) # NOTE: let some time to process
187+
await asyncio.sleep(ONE_FRAME) # NOTE: let some time to process
188188
await self.backend.execute(f"tagwindow -pypr_noanim address:{scratch.full_address}")
189189

190190
# move

pyprland/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Package version."""
22

3-
VERSION = "3.1.2-4"
3+
VERSION = "3.1.2-6"

0 commit comments

Comments
 (0)