Skip to content

windows_terminal

This directory provides support for using Talon with the Windows Terminal application.

The windows_terminal.talon file contains Talon code that activates the context for Windows Terminal, and makes several features available:

  • It activates the terminal, user.generic_windows_shell, user.git, user.anaconda, user.tabs, and user.splits tags. This makes the commands defined in the corresponding files available in the Windows Terminal context.
  • It defines some basic commands for interacting with the window, such as settings open (Ctrl+,), focus left/right/up/down (Ctrl+Alt+Shift+Arrows) and term menu (Ctrl+Shift+F1).
  • It defines the find it command which uses edit.find() to find a string in the terminal. The <phrase>$ variant can be used to find consecutive matches.

The windows_terminal.py file contains Python code that defines the specific behavior for the Windows Terminal application. It includes:

  • Mappings for basic app actions such as tab_close (Ctrl+Shift+W) and tab_open (Ctrl+Shift+T) in the AppActions class.
  • Mappings for paste (Ctrl+Shift+V), copy (Ctrl+Shift+C), and find (Ctrl+Shift+F) in the EditActions class.
  • Several implementations of user actions in the UserActions class including:
    • file_manager_current_path which extracts the current path from the window title. It also allows for remapping and excluding certain paths.
    • file_manager_open_directory, file_manager_select_directory, file_manager_new_folder, file_manager_open_file, file_manager_select_file, file_manager_open_volume which implement file manager commands by inserting the appropriate command line arguments into the terminal.
    • tab_jump which jumps to a specific tab by using Ctrl-Alt-number.
    • split_window_vertically (Shift+Alt+Plus), split_window_horizontally (Shift+Alt+Minus), and several other split actions that are not directly supported by Windows Terminal. These show a notification that the user should use the provided split commands instead of the requested split command.
    • tab_final which goes to the last tab using Ctrl+Alt+9.

These two files work together to provide a comprehensive set of commands for interacting with Windows Terminal using Talon. The .talon file defines the context and some basic commands, while the .py file implements the specific logic for each action. The user.splits and user.tabs tags in windows_terminal.talon activate the corresponding actions defined in windows_terminal.py.