Skip to content

apple_terminal

The community/apps/apple_terminal directory contains files that provide support for using Talon with the Apple Terminal application.

The core functionality is defined in apple_terminal.talon. This file activates several important tags: * terminal: This tag makes the commands defined in terminal.talon available, providing general terminal functionality. * user.readline: This tag enables readline keybindings for editing commands within the terminal. * user.generic_unix_shell: This tag activates the commands and functions in terminal.talon, which provide generic Unix shell functionality. * user.git, user.anaconda, and user.kubectl: These tags make commands specific to those applications available, but can be disabled if not used. * user.tabs and user.file_manager: These tags activate additional functionality related to tab management and file management within the terminal.

The apple_terminal.talon file also defines suspend and resume commands. The suspend command sends ctrl-z to the terminal, which suspends the current process. The resume command types fg followed by enter, which resumes the suspended process.

The file apple_terminal.py defines the application context and implements custom actions for the Apple Terminal. * It defines a context that matches the apple_terminal application. * It remaps the edit.delete_line() action to ctrl-u. * It provides file manager actions within a user context such as: * file_manager_current_path(): Extracts the current path from the terminal's window title. * file_manager_open_directory(path): Inserts a cd command into the terminal. * file_manager_open_parent(): Inserts a cd .. command into the terminal. * file_manager_select_directory(path): Inserts the provided path. * file_manager_new_folder(name): Inserts a mkdir command with the provided name. * file_manager_open_file(path): Inserts the provided path, followed by enter. * file_manager_select_file(path): Inserts the provided path. * It defines application actions within an app context, specifically tab_previous() and tab_next() which use the keyboard shortcuts for switching tabs in the Apple Terminal application.