From ef8bf677ae0a0d8cfc22552d021d7fb2e6ce2f3b Mon Sep 17 00:00:00 2001 From: redxef Date: Sat, 29 Oct 2022 14:47:17 +0200 Subject: [PATCH] Specify final workspace to switch to after startup. --- i3toolwait | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/i3toolwait b/i3toolwait index d935f1a..e04ac9c 100755 --- a/i3toolwait +++ b/i3toolwait @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- -import collections.abc import typing import asyncio import signal @@ -380,6 +379,7 @@ class Config(pydantic.BaseModel): signal: typing.Optional[Signal] = None timeout: int = 3000 programs: typing.List[ProgramConfig] + final_workspace: typing.Optional[str] = None class RuntimeData(pydantic.BaseModel): programs: typing.List[ProgramConfig] = [] @@ -455,6 +455,9 @@ async def run(config: Config, *, debug: bool): await asyncio.wait_for(runtime_data.ipc.main(), timeout=new_timeout/1000) except asyncio.TimeoutError: return 1 + finally: + if config.final_workspace is not None: + await runtime_data.ipc.command(f'workspace {config.final_workspace}') return 0 @click.group()