Skip to content

file_extension

This directory provides a seamless way to insert file extensions using voice commands in Talon. It defines a voice-accessible list of common file extensions, mapping how you say them (e.g., "dot pie") to how they are written (e.g., .py).

How It Works

The functionality is split across two core files that manage the data mappings and the voice commands:

  • file_extension.py: This Python script defines a Talon list called file_extension.

    It contains a default dictionary (_file_extensions_defaults) of common file extensions mapping various spoken pronunciations (like "dot jason" or "dot jay son" to .json, and "dot see" to .c).

    To allow for easy user personalization, the file uses the @track_csv_list decorator to watch a user-configurable CSV file named file_extensions.csv. If this CSV file is modified by the user, the on_update function automatically updates the active Talon list with the customized mappings, merging them with or overriding the default values.

  • file_extension.talon: This Talon file defines the rule that binds the spoken list items to text entry. When a user speaks any phrase from the active user.file_extension list, Talon intercepts the voice command and inserts the corresponding file extension as text. For example, saying "dot mark down" triggers the insertion of .md.