Skip to content

Commit

Permalink
double startup relayout
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Aug 26, 2024
1 parent f0db9d4 commit af680d6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pyprland/plugins/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit af680d6

Please sign in to comment.