Skip to content

foxit_reader

This directory provides Talon voice control integration for Foxit Reader (and Foxit PDF Reader) on Windows. It standardizes basic operations such as tab management and document page navigation by mapping standard Talon actions to Foxit-specific keyboard shortcuts.

The implementation consists of two core files:

  • foxit_reader.py defines the application matching rules and overrides default actions.
  • foxit_reader.talon activates relevant command sets (tags) and defines custom voice commands.

How It Works

When a window matching Foxit Reader gains focus, Talon activates the foxit_reader context. This triggers the behavior defined across the two files.

Application Matching & Context

In foxit_reader.py, a module-level application definition matches Foxit Reader based on Windows OS and the executable name (foxitreader.exe or foxitpdfreader.exe) or the application title. Once matched, the context app: foxit_reader is declared active.

Tab Management

The integration enables standard tab navigation by tagging user.tabs in foxit_reader.talon.

In foxit_reader.py, standard tab actions are modified to align with Foxit's capabilities: * Open Tab: Mapped to ctrl-o (the file open dialog in Foxit). * Unsupported Actions: Foxit does not support advanced tab operations like duplicating, reopening, or jumping to specific tab indexes. If a user attempts these commands, the script intercepts them and displays a notification (actions.app.notify) explaining that the action is unsupported. * Close All Tabs: A custom voice command in foxit_reader.talon maps "tab close all" to ctrl-shift-w.

By enabling the user.pages tag, standard page commands are wired into the application. foxit_reader.py implements the backend for these actions using Foxit's native hotkeys:

  • Next / Previous Page: Mapped to the right and left arrow keys.
  • Jump to Page: Triggers Foxit's "Go To Page" dialog (ctrl-g), inserts the target page number, and presses enter.
  • Current Page: Triggers ctrl-g and grabs the selected text in the page number field to determine the current location.
  • Go to End: Presses the end key.
  • Rotate Page: Maps rotation actions to Foxit's default hotkeys (shift-ctrl-keypad_plus for right and shift-ctrl-keypad_minus for left).