Fix ipc command generation.

This commit is contained in:
redxef 2022-10-28 21:47:24 +02:00
parent 6f4d9032b4
commit e1beb78bfe
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import collections.abc
import asyncio import asyncio
import functools import functools
import json import json
@ -280,7 +281,7 @@ def window_new(configs: list[dict], debug: bool):
if filter.reduce(e.ipc_data): if filter.reduce(e.ipc_data):
container_id = e.ipc_data['container']['id'] container_id = e.ipc_data['container']['id']
await ipc.command(f'for_window [con_id="{container_id}"] focus') await ipc.command(f'for_window [con_id="{container_id}"] focus')
await ipc.command(f'for_window [con_id="{container_id}"] move container to workspace {workspace}') await ipc.command(f'move container to workspace {workspace}')
configs.pop(i) configs.pop(i)
if not configs: if not configs:
ipc.main_quit() ipc.main_quit()
@ -294,7 +295,7 @@ async def run(configs: list[dict], *, timeout: int, debug: bool):
for cfg in configs: for cfg in configs:
cfg['filter'] = parse(cfg['filter']) cfg['filter'] = parse(cfg['filter'])
p = cfg['program'] p = cfg['program']
if isinstance(p, list): if isinstance(p, collections.abc.Iterable):
p = ' '.join(p) p = ' '.join(p)
coroutines += [ipc.command(f'exec {p}')] coroutines += [ipc.command(f'exec {p}')]
await asyncio.gather(*coroutines) await asyncio.gather(*coroutines)