A Tabby plugin that adds per-profile working directory and post-connect script execution for SSH and Local shell connections.
Tabby's built-in login scripts handle basic expect/send pairs for automating connection flows. This plugin builds on top of that foundation with a more flexible approach to post-connection setup: a dedicated working directory field that navigates to your project on connect, a multi-line script area for running setup commands in sequence, smart shell prompt detection so commands execute only when the terminal is ready, and configurable navigation methods depending on your workflow.
It does not replace or interfere with existing login scripts — both systems run independently, with this plugin's actions executing after the built-in scripts complete.
- Open Tabby Settings
- Go to the Plugins tab
- Search for
tabby-post-connect-actions - Click Install
From Tabby's plugin directory:
cd "$(echo ~/Library/Application\ Support/tabby/plugins)" # macOS
# cd "%APPDATA%/tabby/plugins" # Windows
# cd ~/.config/tabby/plugins # Linux
npm install tabby-post-connect-actions --legacy-peer-depsThen restart Tabby.
Open Tabby Settings and navigate to the Post-Connect Actions tab. From there you can select any profile and configure:
| Field | Type | Default | Description |
|---|---|---|---|
Working Directory |
string |
"" |
Path to navigate to after connecting. Leave empty to skip. |
Post-Connect Script |
string |
"" |
Multi-line script to run after navigating. Each non-empty line is sent as a separate command. |
CD Method |
"send" | "command" |
"send" |
How to change directory. "send" types cd /path into the terminal. "command" sends cd /path && exec $SHELL to replace the shell in-place (SSH only — falls back to "send" for local shell). |
Wait for Prompt |
boolean |
true |
Wait for a shell prompt before running commands. |
Prompt Timeout |
number |
5000 |
Maximum time (ms) to wait for a prompt before proceeding anyway. |
Configuration is stored in Tabby's global config under postConnectActions.profiles, keyed by profile ID.
Navigate to a project directory on connect:
- Set
Working Directoryto/home/deploy/my-project
Activate a Python virtualenv after connecting:
- Set
Working Directoryto/home/user/my-project - Set
Post-Connect Scriptto:source venv/bin/activate export DJANGO_SETTINGS_MODULE=config.production
Source environment and start services on a dev server:
- Set
Working Directoryto/opt/app - Set
Post-Connect Scriptto:source ~/.nvm/nvm.sh nvm use 18 export NODE_ENV=development
The plugin uses Tabby's TerminalDecorator API to hook into the terminal session lifecycle. When a connection is established:
- Prompt detection — If enabled, the plugin watches terminal output for common shell prompt characters (
$,#,>,%), stripping ANSI escape codes for reliable matching. If no prompt is detected within the timeout, it proceeds anyway. - Directory change — If a working directory is set, the plugin navigates to it using the configured method.
- Script execution — If a post-connect script is set, each non-empty line is sent to the terminal with a short delay between lines.
Actions automatically re-run if the session reconnects.
| Connection Type | Supported | Notes |
|---|---|---|
| SSH | Yes | Full support including cdMethod: "command" |
| Local shell | Yes | cdMethod: "command" falls back to "send" |
| Serial | No | — |
| Telnet | No | — |
# Install dependencies
npm install --legacy-peer-deps
# Build
npm run build
# Watch mode
npm run watch
# Run tests
npm test
# Lint
npm run lint
# Format
npm run formatThis plugin was developed with the assistance of Claude by Anthropic. All commits in this repository include a Co-authored-by: Claude <noreply@anthropic.com> trailer to reflect this collaboration.
MIT