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:

ToolResponsibility
tmuxTerminal multiplexer (sessions, panes, windows)
seshWorkspace/session manager
tSimple launcher for sesh + tmux

Key design decisions:

  • tmux remains untouched
  • t acts 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:

WorkspaceDirectory
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.

  1. 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
}
  1. Reload your shell:
source ~/.zshrc

Command Reference

CommandPurposeAction
tShow helpDisplays the figlet banner, usage, and available commands
t aAttach to tmuxtmux attach if a session exists
t sessionsList running tmux sessionstmux ls
t configList configured sesh workspacessesh list --config
t lsShow running sessions + configured workspacestmux ls + sesh list --config
t connect <name>Connect to workspacesesh connect <name>
t c <name>Short for connectsesh connect <name>

Scenarios

SituationCommandResult
Need a quick reminder of available commandstShows banner, usage, and command list
Attach to an existing tmux sessiont aAttaches to tmux if a session is running
Check active tmux sessionst sessionsLists running tmux sessions
Check available sesh workspacest configLists configured workspaces from sesh
See both active sessions and configured workspacest lsShows tmux sessions first, then sesh workspaces
Open a workspace by full commandt connect skilledinConnects to the skilledin workspace
Open a workspace using shorthandt c nvimConnects to the nvim workspace