Skip to content
casselPublic

About

A terminal UI for picking, creating, and switching tmux sessions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

xtmux

English · Português (Brasil) · Español · 简体中文

A terminal UI for picking tmux sessions. Closed your terminal? Your sessions keep running in the tmux server. Open another terminal, run xtmux, and reconnect with Enter.

Install

Requires tmux on your PATH and Go 1.24.2 or newer to build. Use a macOS or Linux terminal.

go install github.com/cassel/xtmux@latest

Add $(go env GOPATH)/bin to your PATH. To build from source:

git clone https://github.com/cassel/xtmux.git
cd xtmux
go build -o xtmux .
./xtmux

Keys

Key Action
↑/↓, k/j Move selection
Enter Attach to the selected session
n Create a session and attach to it
r Rename the selected session
x → y Kill the selected session after confirmation
/ Filter sessions; Esc clears the filter
q / Esc Exit from the session list

Outside tmux, xtmux replaces itself with tmux attach. Inside tmux, it uses switch-client to switch sessions without nesting tmux. The current session is marked current and cannot be killed through xtmux. While filtering, ↑/↓ move the selection and Enter attaches to the highlighted session.

Start automatically in a new terminal

Append this to ~/.zshrc or ~/.bashrc:

# xtmux: choose a tmux session when opening a terminal (q = normal shell)
if [[ -z "$TMUX" && $- == *i* && -t 0 && -t 1 && -z "$XTMUX_SKIP" ]] && command -v xtmux >/dev/null; then
  xtmux
fi

Set XTMUX_SKIP=1 to skip it for a particular terminal. To exclude VS Code's terminal, add && "$TERM_PROGRAM" != vscode inside the [[ ... ]] condition.

After a reboot

Rebooting stops the tmux server. xtmux does not save or restore sessions. tmux-resurrect and tmux-continuum can handle that; xtmux lists the sessions they restore.

Development

go test ./...
go build -o xtmux .
XTMUX_SOCKET=test ./xtmux  # isolated test server (tmux -L test)

About

A terminal UI for picking, creating, and switching tmux sessions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages