Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

tmux-inject

Inject a command into the active tmux session, automatically splitting into the biggest pane (or creating a new window once a pane limit is reached).

Usage

./tmux-inject.zsh "ls -la"

If no command is given, it defaults to ls.

How it works

  • Finds the currently active tmux session, window, and pane.
  • If the current window already has max_pane_per_window panes (default: 4), a new window is created and the command is sent there.
  • Otherwise, the largest pane is split (horizontally or vertically, depending on its aspect ratio) and the command is sent into the new pane.

Configuration

Edit tmux-inject.zsh to change:

  • tmux — path to your tmux binary (default: /usr/local/bin/tmux)
  • max_pane_per_window — max panes per window before a new window is created (default: 4)

Example: GSL / Console application integration

You can use this script as a handler for opening connections (e.g. telnet) into a tmux pane. In your console application preferences, edit the launch command and paste:

osascript -e 'do shell script "/path/to/tmux-inject.zsh \"telnet %h %p\" "'

Requirements

  • zsh
  • tmux

About

Inject command to active tmux session

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages