iterm
This directory contains the Talon voice control integration for iTerm2, a popular terminal emulator for macOS. It configures Talon to recognize when iTerm2 is active and enables a rich set of terminal-specific commands, Unix shell integrations, and tab management shortcuts.
The implementation is split into two core files that work in tandem:
Application Definition and Custom Actions
The iterm.py script defines how Talon identifies iTerm2 and implements the application-specific keyboard shortcuts.
- Application Detection: It registers the application identifier
iterm2specifically for macOS using its bundle IDcom.googlecode.iterm2. - Action Overrides: It overrides standard
useraction classes to map generic voice commands to iTerm2's default hotkeys:tab_jump(number): Maps tocmd-[1-9]to jump directly to a specific tab.tab_final(): Maps tocmd-9to quick-switch to the last active tab.terminal_clear_screen(): Maps toctrl-lto clear the current terminal screen buffer.
Context and Tags Activation
The iterm.talon file activates when iTerm2 is focused on macOS. Instead of defining raw voice commands directly, it primarily activates a suite of specialized tags. This design allows you to reuse global terminal and command-line voice commands seamlessly.
When iTerm2 is active, it enables the following tags:
terminal: Standardizes basic terminal actions.user.generic_unix_shell: Activates common Unix/Linux shell commands (e.g., directory navigation, file operations).user.git: Enables voice control for Git version control commands.user.kubectl: Enables command-line control utilities for Kubernetes.user.tabs: Connects iTerm2 to Talon's unified tab control interface.user.readline: Inherits command-line editing shortcuts (such as standard GNU Readline keybindings).