Skip to content

notepad

This directory contains the Talon configuration and behavior overrides for Notepad, the default Windows text editor. It defines how Talon recognizes the Notepad application and maps standard navigation and manipulation commands to it.

The directory consists of two primary files:

  • notepad.py defines the application context and overrides application-specific window behaviors.
  • notepad.talon activates standard voice command sets (tags) when Notepad is active.

Application Definition and Logic

The notepad.py script registers Notepad within Talon's application registry and refines window-handling behaviors:

  • App Definition: It matches the executable notepad.exe running on Windows (os: windows) and binds it to the app.notepad identifier.
  • Context Matching: It instantiates a context that activates specifically when Notepad is the focused application.
  • Window Action Override: It overrides the standard win.filename() action. In Windows Notepad, the window title typically follows the format Filename.ext - Notepad (or *Filename.ext - Notepad if there are unsaved changes). The overridden action splits the window title on - and inspects the first segment. If a dot (.) is present, it returns that segment as the filename; otherwise, it returns an empty string. This ensures Talon can reliably identify the name of the file currently being edited.

Command Mappings

The notepad.talon file applies whenever Notepad is in focus. Rather than defining unique keyboard shortcuts from scratch, it leverages Talon's modular tag system to enable pre-defined generic voice command sets:

  • tag(): user.tabs — Activates generic tab-management commands (such as opening, closing, and switching tabs), mapping them to Notepad's modern tabbed interface.
  • tag(): user.find_and_replace — Activates standard search and replace commands (such as finding text or navigating search results).