Skip to content

command_history

The command_history directory contains files that implement a command history feature for Talon.

The core logic is in command_history.py. This file defines:

  • command_history_size and command_history_display settings to control how much history is stored and displayed.
  • An on_phrase function that is called each time Talon hears speech. The on_phrase function adds the spoken text to a global history variable and truncates it based on command_history_size. It also calls actions.user.history_transform_phrase_text to allow modifications to the captured text before it is added to the history.
  • An ImGUI window gui that displays the command history. The number of lines displayed depends on command_history_display, unless the user has toggled the hist_more variable to show the whole history. This window also includes a button to close the command history window.
  • A set of actions implemented in the Actions class. These actions control the command history such as toggling the display, clearing the history, and retrieving a specific history entry. Notably, the history_transform_phrase_text action allows for customization of how text is added to the history; by default it only displays text when speech is enabled and joins words with spaces.

command_history.talon defines a set of Talon commands that are linked to the actions in command_history.py. These commands enable users to interact with the command history using speech. For example "command history" toggles the display, "command history clear" clears the history, and "command history more" displays the entire history.

The files work together to provide the command history functionality. command_history.py defines the core logic and UI, while command_history.talon exposes that functionality via voice commands.