Skip to content

file_manager

This directory implements generic file management capabilities for Talon. It enables hands-free navigation, selection, and manipulation of files and folders in supported file managers (both GUI and command-line interfaces) by dynamic indexing, generating voice-spoken forms of directory contents, and displaying quick-selection overlays.

The implementation relies on three primary files that coordinate state tracking, user interface overlays, and voice trigger mappings:

  • file_manager.py: The Python backend that manages settings, reads the file system, generates spoken forms of files/directories, manages the GUI overlay, and synchronizes lists based on active window events.
  • file_manager.talon: The core file containing platform-independent voice commands for navigating folders, selecting files, and opening terminals.
  • file_manager_win.talon: A platform-specific extension for Windows that adds volume/drive switching commands (e.g., changing to the C: or D: drive).

Core Mechanism

The framework operates by tracking the state of the active window. The integration works through the following sequence of operations:

  1. Window Event Tracking: file_manager.py registers event listeners on win_title and win_focus. When a window receives focus or changes its title, the script checks if the active application context has the user.file_manager tag.
  2. Context-Aware Path Extraction: If the tag is present, the script invokes the action user.file_manager_current_path(). Specific application contexts (implemented elsewhere in the repository) override this action to return the absolute path of the directory currently being viewed.
  3. Dynamic Spoken List Generation: Once the current path is retrieved, file_manager.py reads the directory contents (up to limits configured via settings). It filters out non-descriptive names using a list of excluded words and passes the remaining file/folder names to actions.user.create_spoken_forms_from_list(). This translates complex system names into pronounceable phrases and updates:
    • user.file_manager_directories
    • user.file_manager_files
  4. Indexed Selection Overlays: The files and directories are sorted and displayed in two side-by-side imgui panels (using Talon's built-in GUI engine) if they are enabled via the user.file_manager_auto_show_pickers setting or explicitly toggled by voice. This allows users to target files and directories by simple indexed numbers (e.g., "open numb three").

Command Reference & Interaction

The voice commands defined in file_manager.talon hook into the dynamic spoken lists and index arrays.

  • Navigation: Commands like go parent or daddy ascend the folder hierarchy. Users can say follow <directory_name> using the spoken form generated by the script, or use index numbers shown on the GUI overlay with follow numb <number>.
  • File Selection: You can highlight files or folders without opening them via select folder <name> or select file numb <number>.
  • Execution & Manipulation: Saying open <file_name> triggers the application's default open behavior. You can also run system commands such as folder new <name> to create a subdirectory, properties show to inspect metadata, or terminal here to spin up a shell in the directory's current path.
  • Pagination: For large directories, users can paginate through the generated list overlays by saying folder next, folder last, file next, or file last.

On Windows environments, the command list is augmented by file_manager_win.talon to allow drive-swapping (e.g. saying go cap to transition to C:).