Skip to content

windows_command_processor

This directory provides Talon voice control integration for the classic Windows Command Prompt (cmd.exe). It enables hands-free operation of the terminal, whether running as a standalone legacy console window or hosted inside the modern Windows Terminal application.

The integration is driven by a single key script:

  • command_processor_win.py: Implements the context rules, overrides standard Talon actions, and translates cross-platform terminal commands into native Command Prompt instructions.

How It Works

The script leverages Talon's context-matching engine to target active cmd.exe sessions and overrides generic API actions to align with Command Prompt behavior:

  • Context & Tags: The configuration matches processes named windows_command_processor, as well as windows_terminal instances that contain "Command Prompt" in their window title. Once active, it binds the terminal, user.file_manager, user.git, and user.kubectl tags, making standard commands for those environments available.
  • Working Directory Tracking: Standard command shells do not always expose their current working directory to the OS window manager. To solve this, the script implements a title-parsing strategy:
    • file_manager_refresh_title executes title Command Prompt: %CD% inside the prompt to force the current directory path into the window's title bar.
    • file_manager_current_path reads the active window title, cleans up administrative prefixes, and extracts the path so Talon knows where the user is in the filesystem.
  • Directory Navigation: Standard file manager commands are converted into Command Prompt syntax. For instance, changing directories executes cd "<path>" followed by a title refresh, and switching drives is handled by mapping the path directly to the drive volume (e.g., D:).
  • Terminal Operations: Common terminal utilities are mapped to their Windows Command Prompt equivalents:
    • Listing files maps to dir or dir /a.
    • Clearing the screen executes cls.
    • Aborting running commands triggers ctrl-c followed by an automatic y response to safely bypass the "Terminate batch job (Y/N)?" confirmation prompt.
    • Repeating the last command sends the up arrow key followed by enter.