Home

Awesome

tmass

Simple and no-dependency session manager with load and save ability for tmux written in Go (NOT yet stable).

Why?

I need this to manage my tmux sessions, mostly in docker containers and I need this to be no-dependency. The others I found usable, all depend on Ruby or Python.

The other goal is to automatically create a bash script based on the config (not implemented yet).

Installation

This is a gb project.

Clone the source and in source folder run make all to get dependencies and build. next time simply use make

Usage

The config file is much like teamocil, but compatibility is not a goal (currently it is different in some ways).

# Create default config directory
mkdir $HOME/.config/tmass

# 1- Create a tmass config manually:
# Create a sample config
touch $HOME/.config/tmass/sample.yml
# Edit your configuration
$EDITOR $HOME/.config/tmass/sample.yml

# 2- Or Save an existing tmux session
# Run tmux and create your favorite layout inside it
# Rename the session if you want to
tmux rename-session sample
# Save the layout with tmass
tmass save sample
# also --target can be used to rename a saved session
tmass save --target=sample2 sample

# Run tmass with your sample configuration (sample and sample.yml are equal)

tmass load sample

for better usage help, use tmass help

Known issues

Config file

The config file is in yaml format. Each file is a session and each session can have multiple windows and each window can have any number of panes.

Session

PropertyDescription
nameThe name of this session. optional
windowsArray of Window

Window

PropertyDescription
nameName of this window. normally ignored by tmux config
layoutLayout to use with this window. see the tmux man page about layouts
panesArray of Pane or string, the command to run inside the pane

The window name is normally ignored by tmux, since any command inside the window can change the window name. If you want to force tmux to use only your name then disable tmux allow-rename option.

Pane

PropertyDescription
commandsArray of string, each item is a command to be executed inside the pane
rootThe root directory of this pane, the pane switches to this directory before running the commands. default to current dir
focusIs this pane active?

Sample config

Create a two pane window:

name: two-pane-session
windows:
  - name: normally-ignored
    layout: even-horizontal
    panes:
      - git status
      - commands:
          - ls
          - echo "Hey"
        root: ~/workspace/

A session with two windows, the first one contains 3 panes and the next one 2 panes:

name: two-window-per-session
windows:
  - name: window-1
    layout: main-vertical
    panes:
      - ls -al
      - #Nothing
      - echo its me
  - name: window-2
    layout: even-vertical
    panes:
      - cat /etc/resolv.conf
      - #ignored

Auto complete for bash and zsh

Bash

Copy bash_tmass in your bash-autocomplete folder or simply add this into your .bashrc :

. /path/to/this/file/bash_tmass

zsh

Rename the zsh_tmass to _tmass and copy it inside the zsh autocomplete folder like this (in Archlinux) :

cp zsh_tmass /usr/share/zsh/site-functions/_tmass

or add this into your .zshrc :

fpath=("/path/to/_tmass" $fpath)
autoload -U compinit
compinit

Notes/TODO