Skip to content

address

This directory defines a standardized, abstract interface for voice-interacting with applications that feature path or URL navigation—such as web browsers, FTP clients, and file managers (e.g., macOS Finder or Windows File Explorer).

By establishing a common set of actions and commands, this module allows you to use the same voice commands across different applications, while the underlying implementation adapts to the specific active window.

How It Works

The functionality is split into an abstract API definition (written in Python) and a corresponding set of voice commands (written in Talon format).

address.py

This file acts as the interface definition. It declares the user.address tag and defines the API contract that application-specific contexts must implement:

  • address Tag: Registered to mark an application as supporting address-based navigation.
  • <user.address> Capture: A placeholder capture for parsing addresses or paths. Because different applications navigate using different syntaxes (e.g., web URLs vs. local file paths), the actual grammar for this capture must be implemented in application-specific context files.
  • Actions:
    • address_focus(): Focuses the application's address input field (like the URL bar in a browser).
    • address_copy_address(): Copies the current path or URL to the clipboard.
    • address_navigate(address): Instructs the application to navigate directly to the specified destination.

address.talon

This file defines the voice commands that are exposed to the user when the user.address tag is active. It maps spoken phrases directly to the actions defined in the Python interface:

  • go [to] <user.address>: Triggers navigation to a spoken address.
  • address copy | copy path | url copy | copy address | copy url: Triggers the copy action.
  • address bar | go address | go url: Focuses the input field.

Integration and Extensibility

Because the actions in address.py have no default implementation, they function as virtual methods.

When you write code for a specific application (for example, a web browser like Chrome), you activate the user.address tag in its context and override these actions. In Chrome, address_focus() might execute key(ctrl-l), whereas in macOS Finder, it might trigger the "Go to Folder" sheet via key(cmd-shift-g). This decoupling ensures that you only need to memorize one set of voice commands, regardless of which application is currently in focus.