Skip to content

finder

The community/apps/finder directory contains files that integrate Talon with the macOS Finder application, providing voice commands for file management and navigation.

The finder.talon file, found at https://github.com/talonhub/community/blob/main/apps/finder/finder.talon, defines the voice commands and tags that are used within the Finder. It assigns the user.address, user.file_manager, user.navigation, and user.tabs tags, allowing these actions to be used in the finder. It provides voice commands for: * Opening preferences (preferences: key(cmd-,)), options (options: key(cmd-j)), and search (search: key(cmd-alt-f)). * Sorting files by none, name, kind, date opened, date added, date modified, and size. For example, saying "sort by name" executes key(ctrl-alt-cmd-1). * Changing the view mode including icon view, column view, list view, and gallery view. For example, saying "column view" executes key(cmd-3). * Trashing files (trash it: key(cmd-backspace)). * Hiding the Finder or other applications.

The finder.py file, located at https://github.com/talonhub/community/blob/main/apps/finder/finder.py, implements the actions that are called from the finder.talon file. It defines a Talon context that is only active when the focused application is the Finder, and provides actions to: * Open the parent directory (file_manager_open_parent): executes key(cmd-up). * Get the current path (file_manager_current_path): retrieves the title of the active window, expands it if it includes ~, remaps known paths from the directories_to_remap dictionary (e.g. an empty string to /Volumes), and removes paths from directories_to_exclude. * Open a terminal in the current directory (file_manager_terminal_here): executes an AppleScript that gets the current path and then opens a new Terminal window or tab and cds to the path. * Show properties for a file or folder (file_manager_show_properties): executes key(cmd-i). * Open or select a directory, file or folder (file_manager_open_directory, file_manager_select_directory, file_manager_open_file, file_manager_select_file): executes key(cmd-shift-g), key(home), key(cmd-o) and then types the path passed to the function, followed by key(enter) for file_manager_open_directory. * Create a new folder (file_manager_new_folder): executes key(cmd-shift-n) and inserts the folder name. * Focus the address bar or copy the current address (address_focus, address_copy_address): executes key(cmd-shift-g) and key(alt-cmd-c). * Navigate to an address (address_navigate): calls actions.user.file_manager_open_directory(address).

These files work together to allow a user to control Finder using voice commands, including file navigation, view changes, and other file management actions.