diff --git a/pyprland/plugins/monitors.py b/pyprland/plugins/monitors.py index 4793363..5dc843f 100644 --- a/pyprland/plugins/monitors.py +++ b/pyprland/plugins/monitors.py @@ -113,8 +113,9 @@ async def on_reload(self) -> None: # run relayout after 1second without blocking async def _delayed_relayout() -> None: + await self._run_relayout(monitors) await asyncio.sleep(1) - await self.run_relayout(monitors) + await self._run_relayout() await asyncio.create_task(_delayed_relayout()) @@ -133,7 +134,11 @@ def _build_monitor_command(self, monitor: MonitorInfo, config: dict[str, dict[st # Command - async def run_relayout(self, monitors: list[MonitorInfo] | str | None = None) -> bool: + async def run_relayout(self) -> bool: + """Recompute & apply every monitors's layout.""" + return await self._run_relayout() + + async def _run_relayout(self, monitors: list[MonitorInfo] | str | None = None) -> bool: """Recompute & apply every monitors's layout.""" if isinstance(monitors, str): self.log.error("relayout doesn't take any argument") @@ -169,7 +174,7 @@ async def event_monitoradded(self, name: str) -> None: monitors = await self.hyprctl_json("monitors") await self._hotplug_command(monitors, name) - if not await self.run_relayout(monitors): + if not await self._run_relayout(monitors): default_command = self.config.get("unknown") if default_command: await asyncio.create_subprocess_shell(default_command)