Open 2shea opened 6 years ago
https://github.com/talonvoice/talon/issues/58
from talon import ctrl
from talon.engine import engine
from talon.voice import Context
enter_flag = False
def on_phrase_post(j):
global enter_flag
if j['cmd'] == 'p.end':
phrase = j['phrase']
if enter_flag and phrase and phrase[-1] == 'run':
print('HELLO')
enter_flag = False
ctrl.key_press('enter')
def set_enter_flag(m):
global enter_flag
enter_flag = True
engine.register('post:phrase', on_phrase_post)
ctx = Context('hmm')
ctx.keymap({'run': set_enter_flag})
or lambda m: cron.after('0.5s', lambda: ctrl.key_press('enter'))
e.g., don't have to say "enter" after all git commands like "run get commit enter"