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_sizeandcommand_history_displaysettings to control how much history is stored and displayed.- An
on_phrasefunction that is called each time Talon hears speech. Theon_phrasefunction adds the spoken text to a globalhistoryvariable and truncates it based oncommand_history_size. It also callsactions.user.history_transform_phrase_textto allow modifications to the captured text before it is added to the history. - An ImGUI window
guithat displays the command history. The number of lines displayed depends oncommand_history_display, unless the user has toggled thehist_morevariable to show the whole history. This window also includes a button to close the command history window. - A set of actions implemented in the
Actionsclass. These actions control the command history such as toggling the display, clearing the history, and retrieving a specific history entry. Notably, thehistory_transform_phrase_textaction 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.