modes.py (1806B)
1 from talon import Context, Module, app, actions, speech_system 2 3 mod = Module() 4 5 modes = { 6 "admin": "enable extra administration commands terminal (docker, etc)", 7 "debug": "a way to force debugger commands to be loaded", 8 "gdb": "a way to force gdb commands to be loaded", 9 "ida": "a way to force ida commands to be loaded", 10 "presentation": "a more strict form of sleep where only a more strict wake up command works", 11 "windbg": "a way to force windbg commands to be loaded", 12 } 13 14 for key, value in modes.items(): 15 mod.mode(key, value) 16 17 18 @mod.action_class 19 class Actions: 20 def talon_mode(): 21 """For windows and Mac with Dragon, enables Talon commands and Dragon's command mode.""" 22 actions.speech.enable() 23 24 engine = speech_system.engine.name 25 # app.notify(engine) 26 if "dragon" in engine: 27 if app.platform == "mac": 28 actions.user.engine_sleep() 29 elif app.platform == "windows": 30 actions.user.engine_wake() 31 # note: this may not do anything for all versions of Dragon. Requires Pro. 32 actions.user.engine_mimic("switch to command mode") 33 34 def dragon_mode(): 35 """For windows and Mac with Dragon, disables Talon commands and exits Dragon's command mode""" 36 engine = speech_system.engine.name 37 # app.notify(engine) 38 39 if "dragon" in engine: 40 # app.notify("dragon mode") 41 actions.speech.disable() 42 if app.platform == "mac": 43 actions.user.engine_wake() 44 elif app.platform == "windows": 45 actions.user.engine_wake() 46 # note: this may not do anything for all versions of Dragon. Requires Pro. 47 actions.user.engine_mimic("start normal mode")