Allow program to be a list.
This commit is contained in:
parent
089fc6fe22
commit
1d2623ec66
1 changed files with 5 additions and 4 deletions
|
@ -330,8 +330,7 @@ def simple(ctx, filter, timeout, workspace, program):
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
@click.option('--timeout', '-t', default=3000, help="Wait time for a window to appear (and match) in milliseconds.")
|
@click.option('--timeout', '-t', default=3000, help="Wait time for a window to appear (and match) in milliseconds.")
|
||||||
@click.option('--configs', '-c', default='-', type=click.File('r'), help="A list of startup programs in json")
|
@click.option('--configs', '-c', default='-', type=click.File('r'), help="A list of startup programs in json")
|
||||||
@click.argument('program', nargs=-1)
|
def config(ctx, timeout, configs):
|
||||||
def config(ctx, timeout, configs, program):
|
|
||||||
"""
|
"""
|
||||||
Start a program and move it's created window to the desired i3 workspace.
|
Start a program and move it's created window to the desired i3 workspace.
|
||||||
|
|
||||||
|
@ -341,7 +340,6 @@ def config(ctx, timeout, configs, program):
|
||||||
1 when no window has been found.
|
1 when no window has been found.
|
||||||
"""
|
"""
|
||||||
debug = ctx.obj['DEBUG']
|
debug = ctx.obj['DEBUG']
|
||||||
program = ' '.join(program)
|
|
||||||
configs = yaml.load(configs, Loader=SafeLoader)
|
configs = yaml.load(configs, Loader=SafeLoader)
|
||||||
|
|
||||||
ipc = i3ipc.Connection()
|
ipc = i3ipc.Connection()
|
||||||
|
@ -349,7 +347,10 @@ def config(ctx, timeout, configs, program):
|
||||||
|
|
||||||
for cfg in configs:
|
for cfg in configs:
|
||||||
cfg['filter'] = parse(cfg['filter'])
|
cfg['filter'] = parse(cfg['filter'])
|
||||||
ipc.command(f'exec {cfg["program"]}')
|
p = cfg['program']
|
||||||
|
if isinstance(p, list):
|
||||||
|
p = ' '.join(p)
|
||||||
|
ipc.command(f'exec {p}')
|
||||||
started_at = time.monotonic_ns() // (1000*1000)
|
started_at = time.monotonic_ns() // (1000*1000)
|
||||||
ipc.main(timeout=timeout / 1000)
|
ipc.main(timeout=timeout / 1000)
|
||||||
total_time = time.monotonic_ns() // (1000*1000) - started_at
|
total_time = time.monotonic_ns() // (1000*1000) - started_at
|
||||||
|
|
Loading…
Reference in a new issue