Compare commits

..

2 commits

Author SHA1 Message Date
ef8bf677ae
Specify final workspace to switch to after startup. 2022-10-29 14:47:17 +02:00
e127cdde6a
Remove debug delay. 2022-10-29 14:42:02 +02:00

View file

@ -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] = []
@ -398,7 +398,6 @@ def window_new(runtime_data: RuntimeData, *, debug):
container_id = e.ipc_data['container']['id']
await ipc.command(f'for_window [con_id="{container_id}"] focus')
await ipc.command(f'move container to workspace {cfg.workspace}')
await asyncio.sleep(1)
runtime_data.programs.pop(i)
if not runtime_data.programs:
ipc.main_quit()
@ -456,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()