Skip to content

firefox

This directory contains the Talon voice commands and Python contexts required to interface with the Firefox web browser and its popular derivatives. It provides a consistent set of cross-platform actions and voice commands while handling platform-specific keyboard shortcuts on macOS, Windows, and Linux.

How the Firefox Integration Works

The files in this directory work together by defining a unified application definition, registering generic actions, implementing platform-specific behavior, and finally exposing those actions as voice commands.

1. Application Definition & Core Logic

The core application configuration is managed by firefox.py.

  • Multi-App Matching: It registers multiple naming variations and forks under a single Talon application identifier (app.firefox). This ensures that standard Firefox, Firefox Developer Edition, Firefox ESR, LibreWolf, and Waterfox are all recognized identically across different operating systems.
  • Custom Action Declarations: It defines custom Talon user actions (firefox_bookmarks_sidebar and firefox_history_sidebar) that have platform-specific implementations.
  • Core Browser Overrides: It overrides standard browser actions. For instance, focus_page() relies on entering and exiting the browser search dialog (edit.find() and escape) to reliably shift focus from the address bar back to the webpage body.

2. Platform-Specific Keyboard Mappings

Keyboard shortcuts differ significantly between operating systems. This directory isolates those variations into specialized platform context files:

  • macOS Support: firefox_mac.py targets macOS (os: mac) and maps standard browser commands (such as showing downloads, extensions, and bookmarks) to macOS-specific cmd modifier key combinations.
  • Windows & Linux Support: firefox_win_linux.py handles os: windows and os: linux environments. It maps browser behaviors to ctrl key combinations. It also includes specific workarounds:
    • Developer Tools Address Bar Focus: The focus_address() action uses f6 followed by ctrl-l to prevent clearing the developer console if it is currently focused.
    • Linux Downloads: Uses ctrl-shift-y for Linux systems instead of ctrl-j (used on Windows).

3. Voice Commands

The file firefox.talon provides the user-facing voice command interface when the firefox application is focused.

  • Standard Browser Integration: It activates standard Talon tags (tag(): browser and tag(): user.tabs) to inherit general web browsing commands.
  • Firefox-Specific Commands: It defines targeted voice commands:
    • Tab Search: "tab search" and "tab search <text>" focus the address bar and automatically prepend %—Firefox's native restriction token for searching across currently open tabs.
    • Sidebar Control: "sidebar bookmarks" and "sidebar history" call the respective platform-agnostic actions, pulling the correct shortcut mapping for the host operating system.