Always re-reduce expression.
This commit is contained in:
parent
015849345d
commit
7b8c6df478
1 changed files with 5 additions and 9 deletions
|
@ -146,8 +146,6 @@ class Expression:
|
||||||
raise NotImplementedError('Implement in subclass')
|
raise NotImplementedError('Implement in subclass')
|
||||||
|
|
||||||
def reduce(self, env: Environment, local: LocalEnvironment):
|
def reduce(self, env: Environment, local: LocalEnvironment):
|
||||||
if self._state == Expression.STATE_REDUCED:
|
|
||||||
return
|
|
||||||
self._reduced = self._reduce(env, local, [])
|
self._reduced = self._reduce(env, local, [])
|
||||||
self._state = Expression.STATE_REDUCED
|
self._state = Expression.STATE_REDUCED
|
||||||
|
|
||||||
|
@ -221,8 +219,6 @@ class Function(Expression):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def reduce(self, env: Environment, local: LocalEnvironment):
|
def reduce(self, env: Environment, local: LocalEnvironment):
|
||||||
if self._state == Expression.STATE_REDUCED:
|
|
||||||
return
|
|
||||||
self._reduced = self._reduce(env, local, self._args)
|
self._reduced = self._reduce(env, local, self._args)
|
||||||
self._state = Expression.STATE_REDUCED
|
self._state = Expression.STATE_REDUCED
|
||||||
|
|
||||||
|
@ -590,14 +586,14 @@ def window_new(runtime_data: RuntimeData, *, debug):
|
||||||
if debug:
|
if debug:
|
||||||
print(json.dumps(e.ipc_data))
|
print(json.dumps(e.ipc_data))
|
||||||
async with runtime_data.lock:
|
async with runtime_data.lock:
|
||||||
for i, cfg in enumerate(runtime_data.programs):
|
|
||||||
env = Environment(e.ipc_data)
|
env = Environment(e.ipc_data)
|
||||||
local = LocalEnvironment()
|
local = LocalEnvironment()
|
||||||
if runtime_data.init is not None:
|
if runtime_data.init is not None:
|
||||||
parse(runtime_data.init).reduce(env, local)
|
parse(runtime_data.init).reduce(env, local)
|
||||||
|
for i, cfg in enumerate(runtime_data.programs):
|
||||||
cfg.match.reduce(env, local)
|
cfg.match.reduce(env, local)
|
||||||
if debug:
|
if debug:
|
||||||
print(cfg.match.reduced)
|
print(i, cfg.match, cfg.match.reduced)
|
||||||
if cfg.match.reduced:
|
if cfg.match.reduced:
|
||||||
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')
|
||||||
|
|
Loading…
Reference in a new issue