Skip to content

windows_explorer

The community/apps/windows_explorer directory contains files for controlling Windows Explorer and file dialogs using Talon.

The most important files in this directory are:

  • windows_explorer.py: This file contains the core logic for interacting with Windows Explorer and file dialogs. It defines a Talon module that matches the windows_explorer and windows_file_browser apps using their names and executable paths. It also defines a context that matches those apps to the user actions that will be available in those contexts. Most of the interesting logic is in the UserActions class, which defines the following user actions:

    • file_manager_open_parent(): Navigates to the parent directory by sending alt-up.
    • file_manager_current_path(): Returns the current path by getting the title of the active window. It also handles remapping some common directories like "Desktop", "Documents", etc to their full path, and excluding some titles such as "Run", "Task Switching", etc.
    • file_manager_terminal_here(): Opens a command prompt in the current directory by sending ctrl-l to focus the address bar, inserting cmd.exe, and pressing enter.
    • file_manager_show_properties(): Opens the properties dialog for the selected file or folder by sending alt-enter.
    • file_manager_open_directory(path: str): Opens the specified directory by focusing the address bar using ctrl-l, inserting the path, and pressing enter.
    • file_manager_select_directory(path: str): Selects the directory by inserting the path.
    • file_manager_new_folder(name: str): Creates a new folder by sending ctrl-shift-n, then inserts the specified name.
    • file_manager_open_file(path: str): Opens the specified file by inserting the path, and pressing enter.
    • file_manager_select_file(path: str): Selects the file by inserting the path.
    • file_manager_open_volume(volume: str): Opens the specified volume by calling file_manager_open_directory.
    • address_focus(): Focuses the address bar by sending ctrl-l.
    • address_copy_address(): Copies the address bar content by focusing it with ctrl-l and then copying the content to the clipboard with ctrl-c.
    • address_navigate(address: str): Navigates to the specified address by calling file_manager_open_directory.
  • windows_explorer.talon: This file defines the Talon commands that trigger the user actions defined in windows_explorer.py. It activates the user.address, user.file_manager, and user.navigation tags. It also defines some example commands such as go <user.letter> which opens a drive volume, go app data which opens the %AppData% directory and go program files which opens the %programfiles% directory.

These files work together to provide a set of voice commands for navigating and interacting with Windows Explorer and file dialogs. The python file handles the main logic while the talon file provides the commands that use the python logic.