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, anduser.splitstags. 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) andterm menu(Ctrl+Shift+F1). - It defines the
find itcommand which usesedit.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) andtab_open(Ctrl+Shift+T) in theAppActionsclass. - Mappings for
paste(Ctrl+Shift+V),copy(Ctrl+Shift+C), andfind(Ctrl+Shift+F) in theEditActionsclass. - Several implementations of user actions in the
UserActionsclass including:file_manager_current_pathwhich 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_volumewhich implement file manager commands by inserting the appropriate command line arguments into the terminal.tab_jumpwhich 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_finalwhich 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.