t Command
Simple Workspace Launcher for tmux + sesh
t is a lightweight shell helper that acts as a human-friendly launcher for tmux workspaces managed by sesh.
Instead of directly interacting with tmux commands or remembering multiple sesh commands, t provides a small set of intuitive commands to:
- show a quick help menu
- attach to tmux
- list running sessions
- list configured workspaces
- connect to sesh-defined workspaces
Philosophy
The design separates responsibilities clearly:
| Tool | Responsibility |
|---|---|
| tmux | Terminal multiplexer (sessions, panes, windows) |
| sesh | Workspace/session manager |
t | Simple launcher for sesh + tmux |
Key design decisions:
tmuxremains untouchedtacts as a simple entry point for common sesh + tmux actions- attaching to tmux is explicit (
t a) - workspace creation/connection is handled by sesh
Prerequisites
Before using t, you need the following tools installed.
1. Tmux
A terminal multiplexer that allows multiple persistent terminal sessions. Installation instructions: https://github.com/tmux/tmux/wiki/Installing
2. Sesh
sesh is a session/workspace manager built specifically for tmux. It allows defining named workspaces that map to directories. Installation instructions: https://github.com/joshmedeski/sesh?tab=readme-ov-file#how-to-install
Workspace Concept
A workspace is a named configuration in sesh that usually maps to a directory.
Example workspaces:
| Workspace | Directory |
|---|---|
| home | ~ |
| downloads | ~/Downloads |
| dotfiles | ~/dotfiles |
| nvim | ~/.config/nvim |
| zsh | ~/.config/zsh |
| tmux | ~/.config/tmux |
| alacritty | ~/.config/alacritty |
| yazi | ~/.config/yazi |
| sesh | ~/.config/sesh |
| <project_name> | ~/projects/<project_name> |
These are defined inside the sesh configuration ~/.config/sesh/sesh.toml.
3. Figlet
Make sure FIGlet is also installed. We are using ansishadow font.
Installing the t Command
t is implemented as a shell function.
-
Add it to your shell configuration.
Example for zsh (
~/.zshrc):
# t command
t() {
case "${1:-}" in
"")
figlet -f ansishadow "T COMMAND"
echo "Usage: t [command]"
echo
echo "Commands:"
echo " t a Attach to tmux"
echo " t sessions List running tmux sessions"
echo " t config List configured sesh workspaces"
echo " t ls Show running sessions + configured workspaces"
echo " t connect <name> Connect to workspace"
echo " t c <name> Short for connect"
return
;;
a)
if command tmux has-session 2>/dev/null; then
command tmux attach
else
echo "No running tmux session to attach to."
return 1
fi
;;
sessions)
command tmux ls 2>/dev/null || echo "No running tmux sessions."
;;
config)
sesh list --config
;;
ls)
echo "Running tmux sessions:"
command tmux ls 2>/dev/null || echo "No running tmux sessions."
echo
echo "Configured sesh workspaces:"
sesh list --config
;;
connect|c)
if [ -n "$2" ]; then
sesh connect "$2"
else
echo "Usage: t connect <workspace>"
return 1
fi
;;
*)
echo "Unknown command."
echo
echo "Usage: t [a|sessions|config|ls|connect <name>]"
return 1
;;
esac
}- Reload your shell:
source ~/.zshrcCommand Reference
| Command | Purpose | Action |
|---|---|---|
t | Show help | Displays the figlet banner, usage, and available commands |
t a | Attach to tmux | tmux attach if a session exists |
t sessions | List running tmux sessions | tmux ls |
t config | List configured sesh workspaces | sesh list --config |
t ls | Show running sessions + configured workspaces | tmux ls + sesh list --config |
t connect <name> | Connect to workspace | sesh connect <name> |
t c <name> | Short for connect | sesh connect <name> |
Scenarios
| Situation | Command | Result |
|---|---|---|
| Need a quick reminder of available commands | t | Shows banner, usage, and command list |
| Attach to an existing tmux session | t a | Attaches to tmux if a session is running |
| Check active tmux sessions | t sessions | Lists running tmux sessions |
| Check available sesh workspaces | t config | Lists configured workspaces from sesh |
| See both active sessions and configured workspaces | t ls | Shows tmux sessions first, then sesh workspaces |
| Open a workspace by full command | t connect skilledin | Connects to the skilledin workspace |
| Open a workspace using shorthand | t c nvim | Connects to the nvim workspace |
