windows_terminal
This directory provides support for managing and interacting with Windows Terminal using Talon voice commands. It integrates standard terminal interactions, version control commands, and window/split management by mapping them to Windows Terminal's keyboard shortcuts.
The implementation consists of two main files that work together: a configuration file defining the voice triggers and active capabilities, and a Python script mapping the abstract actions to concrete keystrokes.
How It Works
Windows Terminal integration is achieved by combining Talon context tags with customized keyboard shortcut mappings.
Configuration and Voice Commands
The windows_terminal.talon file activates when the user is focused on the Windows Terminal application (app: windows_terminal).
It enables several tags to pull in standard toolsets:
* terminal and user.generic_windows_shell for standard command-line operations.
* user.git and user.anaconda for voice-controlling version control and environment management directly inside the terminal.
* user.tabs and user.splits to manage navigation.
Additionally, it defines voice commands for application-specific shortcuts:
* Settings Access: "settings open" maps to ctrl-,.
* Pane Focus: Commands to navigate between split panes (e.g., "focus left", "focus down").
* Searching: The "find it" commands utilize the application's search capabilities to find specific text patterns.
Action Implementation
The windows_terminal.py script contains the Python implementation backing these commands. It overrides actions defined by Talon's app, edit, and user namespaces:
- Application Actions: Maps standard actions like opening a tab (
tab_open) and closing a tab (tab_close) to Windows Terminal’s default shortcuts (ctrl-shift-tandctrl-shift-w). - Edit Actions: Implements native copy, paste, and search operations using terminal-specific modifiers (e.g.,
ctrl-shift-vfor paste). - Split Management: Implements the
user.splitsactions. Because Windows Terminal handles split panes differently than a typical IDE, the Python script handles this elegantly:- It defines horizontal and vertical split controls using standard Windows Terminal bindings (
shift-alt-plusandshift-alt-minus). - For actions that Windows Terminal cannot do in its default configuration (such as moving an active tab directly to a specific direction or flipping split orientation), it uses
actions.app.notify()to warn the user and suggest the correct fallback commands.
- It defines horizontal and vertical split controls using standard Windows Terminal bindings (