file_manager
The community/tags/file_manager directory contains the core logic for a file manager tag in Talon. It provides a way to navigate, select, and manipulate files and directories using voice commands. This functionality is implemented in the file_manager.talon and file_manager.py files.
-
file_manager.talondefines the voice commands and their corresponding actions. These commands allow the user to:- Navigate directories using commands like "go parent", and "follow" with a directory name or number.
- Select directories and files by name or number.
- Open files and directories using their name or number.
- Create new folders using "folder new" followed by a name.
- Show properties of files or folders using "properties show".
- Open a terminal in the current location with "terminal here".
- Navigate through pages of directories and files using "folder next/last" and "file next/last".
- Refresh the file list using "manager refresh".
- Show or hide file and directory pickers using "manager show" and "manager close".
The file utilizes the
user.file_manager_directoriesanduser.file_manager_fileslists to populate the available options for navigation and selection which are defined infile_manager.py. -
file_manager.pycontains the core Python implementation of the file manager logic. It defines actions, captures, settings, lists, and the UI that makes the voice commands function.- It defines the
user.file_managertag which is used by thefile_manager.talonfile to enable its commands. It also defines the listsuser.file_manager_directoriesanduser.file_manager_filesto hold the current available directories and files, which are populated using theget_directory_mapandget_file_mapfunctions. - The
Actionsclass defines all of the actions used by the talon file, including thefile_manager_open_directory,file_manager_select_file,file_manager_new_folder, etc. These actions are implemented using thePathlibmodule to interact with the filesystem. - The
gui_foldersandgui_filesfunctions are used to render an imgui window displaying the current list of directories and files. These windows are shown or hidden by thefile_manager_toggle_pickersaction. They also provide a way to navigate through pages of directories and files when the limit set byfile_manager_imgui_limithas been reached. - The
update_listsfunction updates theuser.file_manager_directoriesanduser.file_manager_fileslists based on the current path. It usesget_directory_mapandget_file_mapto retrieve a list of directories and files which are used in thegui_filesandgui_foldersfunctions for display. - The file sets up event handlers that use
actions.user.file_manager_current_path()to determine the current path of the file manager and update the available files and directories. When the current path changes, the lists are updated and the imgui windows are refreshed.
- It defines the
The file_manager.talon file defines the voice interface and delegates the actual logic of interacting with the file system to file_manager.py. Together, these files provide the foundation for a voice-controlled file management system in Talon.