Skip to content

splits

This directory implements a generic, unified interface for managing window splits across different applications in Talon. It decouples the spoken commands from the application-specific keystrokes or APIs required to manipulate window splits.

How it Works

The split-management capability is structured as a Talon tag (user.splits) that exposes a consistent set of actions. Applications that support window splitting (such as text editors, IDEs, or terminal multiplexers) can "capture" this tag and provide their own concrete implementations for these actions.

The directory consists of two main files:

  • splits.py: Defines the user.splits tag and declares the blueprint actions.
  • splits.talon: Maps natural voice commands to the declared actions.

splits.py

This Python file acts as the interface definition. It registers the splits tag within the Talon module:

mod.tag("splits", desc="Tag for enabling generic window split commands")

It also defines a series of empty action signatures under the Actions class. These actions represent all the common operations you might perform on window splits, such as:

  • Directional Splitting: split_window_right(), split_window_left(), split_window_down(), split_window_up()
  • Layout Changes: split_window_vertically(), split_window_horizontally(), split_flip(), split_maximize(), split_reset()
  • Navigation & Destruction: split_next(), split_last(), split_number(index), split_clear(), split_clear_all()

By leaving these action definitions blank, splits.py allows other context-specific scripts in the repository to implement the actual keyboard shortcuts or API calls needed to perform the operations in specific applications (e.g., VS Code, Vim, or Emacs).


splits.talon

This file defines the voice vocabulary for window splits. It is configured to activate only when the user.splits tag is enabled:

tag: user.splits
-

It maps intuitive verbal phrases to the generic actions defined in the Python file. For example:

  • "split right" triggers user.split_window_right()
  • "split horizontal" triggers user.split_window_horizontally()
  • "go split <number>" triggers user.split_number(number)
  • "split clear all" triggers user.split_clear_all()