Skip to main content

Automate opening of new tabs and windows in terminal programs

Project description

automate-terminal

Automate opening of new tabs and windows in terminal programs. Currently supports iTerm2, Terminal.app, and Ghostty on macOS, with additional terminals and OSes added by request.

automate-terminal is a best-effort project. Some terminals do not support automation at all!

Installation

pip install automate-terminal
mise install pip:automate-terminal

Or install from source:

git clone https://github.com/yourusername/automate-terminal.git
cd automate-terminal
pip install -e .

Supported Terminals

Terminal New Tabs/Windows Switch by ID Switch by Working Dir List Sessions Paste Commands
iTerm2
Terminal.app
Ghostty

Other terminals are not supported; automate-terminal will exit with an error code in other terminals.

Quick Start

# Check if your terminal is supported
automate-terminal check

# Create a new tab
automate-terminal new-tab /path/to/project

# Switch to existing session by directory
automate-terminal switch-to --working-directory=/path/to/project

# Create new window with initialization script
automate-terminal new-window /path/to/project \
  --paste-and-run="source .env && npm run dev"

Commands

check

Detect terminal capabilities.

automate-terminal check
automate-terminal check --output=json

switch-to

Switch to existing session. Errors if not found.

# By working directory (or use --wd alias)
automate-terminal switch-to --working-directory=/path/to/dir

# By session ID (or use --id alias)
automate-terminal switch-to --session-id=w0t0p2:ABC123

# Both (session ID takes precedence)
automate-terminal switch-to \
  --session-id=w0t0p2:ABC123 \
  --working-directory=/path/to/dir

# Match sessions in subdirectories
automate-terminal switch-to --working-directory=/path/to/dir --subdirectory-ok

new-tab

Create new tab.

automate-terminal new-tab /path/to/dir

new-window

Create new window.

automate-terminal new-window /path/to/dir

list-sessions

List all sessions.

automate-terminal list-sessions
automate-terminal list-sessions --output=json

Options

Output Format

  • --output=text - Human-readable (default)
  • --output=json - JSON for programmatic use
  • --output=none - Silent

Paste and Run

Execute commands after creating/switching sessions.

--paste-and-run="echo 'I run unconditionally'"
--paste-and-run-bash="echo 'I only run if the current shell is bash'"
--paste-and-run-zsh="echo 'I only run if the current shell is zsh'"
--paste-and-run-fish="echo 'I only run if the current shell is fish'"

Shell-specific flags override generic --paste-and-run when detected shell matches.

Debug and Dry Run

--debug     # Enable debug logging to stderr
--dry-run   # Log actions instead of executing them

Use --dry-run to see what AppleScript commands would be executed without actually running them. Useful for debugging and understanding what the tool will do.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automate_terminal-0.1.0.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

automate_terminal-0.1.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file automate_terminal-0.1.0.tar.gz.

File metadata

  • Download URL: automate_terminal-0.1.0.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for automate_terminal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1347ea7dbf91441c332842404c0d1fd66d31bc001ccc30661ec26fc843f8459f
MD5 aad7a3c38f59e0bd1d49ba5a969fc600
BLAKE2b-256 4351650f7bf9c01b5658639f94cfcbac9693e82d452b860fa3282651c16eec73

See more details on using hashes here.

Provenance

The following attestation bundles were made for automate_terminal-0.1.0.tar.gz:

Publisher: pypi.yml on irskep/automate-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file automate_terminal-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for automate_terminal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d97cec4676f3fec4d99eabb4bb7c4c01d20ae5c4c8a97d12c7d44b1e3778f431
MD5 9f3293cb4581924bee8690b02d374127
BLAKE2b-256 7b8cfe197b4bf535828d0c74911d4245b4f4558d4f63f0fc0fec57a37b0cb8ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for automate_terminal-0.1.0-py3-none-any.whl:

Publisher: pypi.yml on irskep/automate-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page