Skip to content

modes

The community/core/modes directory contains files that define and manage different modes of operation for Talon, the voice control system. These modes allow for context-specific behavior and enable or disable certain features, commands, and actions.

Here's a breakdown of the key files and how they work together:

  • modes.py: This file defines the core logic for managing modes, including the "sleep" mode. It sets up contexts for when Talon is in and out of sleep mode and provides actions to enable and disable Talon's speech recognition, as well as Dragon's command mode, if it's being used.
  • sleep_mode.talon: This file defines the behavior of Talon when in "sleep" mode. It disables mouse pop actions and sets up specific, strict wake commands that must be spoken with silence before and after, to prevent accidental activation, and it uses repeaters to handle the case where the user may repeat the wake command before the speech timeout is hit.
  • sleep_mode_wav2letter.talon: This file is specific to the wav2letter speech engine. It is designed to prevent Talon from waking up too easily in sleep mode when using wav2letter, and it is best not to have any other commands here.
  • command_and_dictation_mode.talon: This file manages the "command" and "dictation" modes. It defines commands to switch between these modes and disables the "sleep" mode when entering either of the other modes. It also disables GDB commands when entering dictation mode and clears the language mode.
  • modes_not_dragon.talon: This file defines common commands for speech engines other than Dragon. It includes commands to wake and sleep Talon, as well as a command to sleep all (which disables various other features such as the switcher, history, homophones, and help windows, and also puts the mouse to sleep). These commands allow for more flexibility in waking and sleeping Talon when not using Dragon, because they allow an optional phrase after the command, to avoid waiting for the speech timeout before talking to a human.
  • language_modes.py: This file defines how Talon handles different programming language modes. It maps spoken forms and file extensions to language IDs and allows users to force a language mode, overriding the automatic detection based on file extensions.
  • code_languages.py: This file contains a list of supported code languages, including their IDs, spoken forms, and file extensions. It also includes a map of specific filenames to language identifiers. These are used by language_modes.py to determine the appropriate code language.
  • dictation_mode.talon: This file defines the behavior of Talon in "dictation" mode. It includes commands for inserting text, navigating the cursor, selecting and deleting text, formatting text, and correcting dictation errors. The commands here generally use user.dictation_insert() to properly handle auto-capitalization and spacing.
  • dragon_mode.talon: This file defines commands specific to the Dragon speech engine. It includes commands to switch between "dragon mode" and "talon mode", and to activate or deactivate Dragon's command mode.
  • modes_dragon.talon: This file defines commands for putting Talon to sleep and waking it up when using Dragon. It also includes a "sleep all" command which also puts Dragon to sleep. These commands are similar to those in modes_not_dragon.talon, but they also control Dragon's state. Like the corresponding commands in modes_not_dragon.talon, they allow for an optional phrase after the command.
  • sleep_mode_pop_twice_to_wake.py: This file implements a feature where a double "pop" noise can wake Talon from sleep mode. It defines settings for the minimum and maximum time between two pops to be considered a double pop. It also checks if the zoom mouse is enabled before waking to prevent conflicts.
  • language_modes.talon: This file defines commands for forcing a particular language mode and showing the currently forced language mode, or clearing a forced mode.

In summary, this directory provides a comprehensive system for managing different modes in Talon, including sleep, command, dictation, and language modes. These modes can be used to tailor Talon's behavior to specific contexts and use cases.