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

on under developer
1 minute read

Out Of Date Warning

This article was published on 05/08/2013, this means the content may be out of date or no longer relevant.
You should verify that the technical information in this article is still up to date before relying upon it for your own purposes.

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 > ~/
bash ~/

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)