Jump between tmux sessions instantly.
Three tiny commands — ts, tn, tk — to switch, create and kill tmux sessions from a fast, keyboard-driven list. One Rust binary, no runtime, no config.
- ~400 KB binary
- ~7 ms to first frame
- 1 dependency (libc)
- works inside and outside tmux
tmux sessions 4 sessions 1 api 2 win 3m ❯ 2 notes 1 win 12m 3 web 3 win current now + new session ↑↓/jk move · ⏎ open · 1-9 jump · n new
ts — pick a sessionnew session name ❯ side-project “api” already exists — ⏎ switches to it ⏎ create · esc cancel · empty = folder name
tn — name it, hit enterkill sessions 4 sessions ❯ [x] 1 api [ ] 2 notes [x] 3 old-spike [ ] 4 web current Kill 2 sessions? press y to confirm
tk — mark several, confirm onceThree commands, one binary
tn and tk are symlinks to ts; the name it was started as picks the mode. Subcommands work too: ts new, ts kill.
ts switch
Lists every session with window count, current/attached tags and idle time. Enter opens it, 1–9 jumps straight to a row. A + new session row (or n) creates one.
tn new
Asks for a name; empty uses the current folder name. If the name already exists it simply switches to it instead of erroring.
tk kill
Mark any number of sessions, press Enter, confirm with y. The session you're in is killed last, and you're warned if it's selected.
work never hits work2), and . / : become _ as tmux does itself.Install
Needs tmux and a Rust toolchain (rustup). Developed and tested on Linux; the code is plain POSIX and should build on macOS, but that hasn't been tried.
Per user (recommended)
git clone https://github.com/rohitsx/tmux-ts.git
cd tmux-ts
./install.sh # builds, then installs ts / tn / tk into ~/.local/binMake sure ~/.local/bin is on your PATH. Use another directory with BIN_DIR=/some/dir ./install.sh.
System-wide
cargo build --release
sudo install -m755 target/release/ts /usr/local/bin/ts
sudo ln -sf ts /usr/local/bin/tn
sudo ln -sf ts /usr/local/bin/tkBuild as yourself first — sudo usually can't see a rustup-installed cargo.
Keys
Vim-style and arrow keys both work everywhere.
| Where | Key | Action |
|---|---|---|
| All screens | ↑ ↓ j k Ctrl-n Ctrl-p | Move (wraps around) |
| All screens | g G PgUp PgDn | Top / bottom / page |
| All screens | Esc q Ctrl-c | Quit |
ts | Enter | Open the highlighted session |
ts | 1–9 | Open that session immediately |
ts | n + | New session prompt |
tn | Enter / Ctrl-u / Ctrl-w | Create / clear line / delete word |
tk | Space | Mark / unmark |
tk | Tab | Mark and move to the next row |
tk | a | Mark all (again to clear) |
tk | 1–9 | Toggle that row |
tk | Enter then y | Kill marked sessions (nothing marked = the highlighted one). Any other key cancels. |
Open it with a tmux key
Bind the commands to popups so they appear over whatever you're doing, then vanish.
bind s display-popup -E -w 70 -h 60% "ts" # prefix + s → switch
bind N display-popup -E -w 70 -h 10 "tn" # prefix + N → new
bind X display-popup -E -w 70 -h 60% "tk" # prefix + X → killPut them in ~/.tmux.conf and reload with tmux source ~/.tmux.conf. Note that prefix s replaces tmux's built-in session chooser — pick another key if you want to keep it.
Why it's fast
- No TUI framework. Raw termios plus hand-written ANSI; every frame is built in memory and flushed with a single
write(). It talks to/dev/ttydirectly, so it works in popups and with redirected stdio. - One tmux process per run. Inside tmux, the “which session am I in?” query is chained into the same call as
list-sessions. - It gets out of the way. After you choose,
tsexecs intotmux switch-client/attach-session, so it isn't resident while you work.
Measured on the dev machine: about 6.7 ms median from launch to first frame and exit, of which a bare tmux list-sessions spawn is ~3.2 ms.
Good to know
Inside vs. outside tmux
Inside tmux, ts uses switch-client and tags the session you're in as current; the cursor starts on the most recently active other session. Outside tmux it uses attach-session / new-session, and with no tmux server running, ts and tn go straight to the new-session prompt.
The terminal looks odd after a crash
Run reset. ts restores the terminal on every normal exit, but a hard kill (kill -9) can't clean up after itself.
Where's the config file?
There isn't one — by design. Colours are the standard 16 ANSI colours plus one 256-colour highlight.
License — can I use it at work?
tmux-ts is under the PolyForm Noncommercial License 1.0.0. You may use, copy, modify and share it for any non-commercial purpose: personal use, hobby projects, study, research, and use by charities, schools, public research and government bodies. Commercial use — including using it as part of work for a for-profit company — isn't covered; open an issue if you need a commercial license. It is source-available, not OSI "open source".
Uninstall
rm ~/.local/bin/{ts,tn,tk} (or the same names in /usr/local/bin with sudo).