tmux: generate background auto startup script for all projects with tmuxinator

5th August 2013 – 176 words

Tmux is running in the background as long as the server is up. But after restart, one has to restart/configure all open session.

Fortunatly, tmux has a CLI API, which tmuxinator, a configuration tool, can speak to. I don’t need tmuxinator for attaching/joining to my sessions, but it’s quite nice for generating the initial setup:

mux new blog
# ... defining panes, tabs, window-names, session name
for i in `ls ~/.tmuxinator/ | sed 's/.yml//'`; do mux debug $i | head -n -5 ; done > ~/monstertmux.sh
bash ~/monstertmux.sh

With this, we loop through all tmuxinator configs, giving us the shell output (debug) stripping the last 5 lines, which would otherwise attach to the session and save it to a shell script

(this is a very localized problem, but nevertheless, I post it here, because my Blog is my best and most stable knowledge base :). Maybe it even helps other people)