Skip to content

chrome

This directory provides Google Chrome integration for Talon Voice. It handles application identification across multiple operating systems, implements cross-platform hotkeys, and defines voice commands for Chrome-specific functions like searching tabs or switching user profiles.

The integration is split into two primary components: * chrome.py handles application definition, context matching, and Python-defined actions. * chrome.talon defines the voice commands, enables standard tag-based behavior, and maps commands to keyboard shortcut actions.

Application Definition and Context

To ensure Google Chrome is correctly recognized regardless of the host operating system, chrome.py registers several rules under the unified application name app.apps.chrome.

It matches: * Windows: The executable name chrome.exe. * macOS: The bundle identifiers for Google Chrome (com.google.Chrome), Chrome Canary (com.google.Chrome.canary), and Chromium (org.chromium.Chromium). * Linux: Executable names such as chrome, chromium-browser, chromium, or application name Google-chrome.

When Chrome is active, chrome.py applies the app: chrome context. This triggers the voice commands declared in chrome.talon.

Cross-Platform Action Handling

The helper scripts implement and override several actions to ensure consistent behavior across platforms:

  • Platform-specific Modifiers: chrome.py defines a custom action user.chrome_mod(key). This utility automatically maps the modifier key to cmd on macOS and ctrl on Windows or Linux, simplifying hotkey mapping in chrome.talon.
  • Browser Navigation: The standard browser.show_extensions() action is overridden to open a new tab and navigate directly to chrome://extensions.
  • Tab Closing: The standard tab closing behavior is wrapped with a custom delay (tab_close_wrapper) to ensure smoother interaction when repeatedly closing tabs.

Voice Commands

The chrome.talon file activates generic tags for standard web navigation and tab management:

  • tag(): browser (enables generic commands like back, forward, refresh, and bookmarking)
  • tag(): user.tabs (enables basic tab operations like next/previous tab)

In addition to standard browser actions, it maps several specialized commands:

  • Profile Switch: Triggered by "profile switch", this opens Chrome's user profile picker using user.chrome_mod("shift-m").
  • Tab Searching: "tab search" opens the native Chrome tab-search interface using user.chrome_mod("shift-a"). Additionally, "tab search <user.text>" opens this interface, pauses briefly, and automatically types the dictated search query to find a specific open tab quickly.