Joseph Mayer <joseph.ma...@protonmail.com> wrote:
> Hi,
> 
> I have one single command for starting and (re)attaching to tmux, and
> it's "tmux -u new -t main". It works as it should.
> 
> On each fresh tmux start, tmux runs /etc/tmux.conf , and so I put some
> general configuration in there like "set -g status-bg SOMECOLOR".
> 
> I'd now like tmux to create five windows on startup, and each window
> should be running a particular program e.g. "top" in one window, "ksh"
> in another, and so on.
> 
> How do I do this - is it possible to add as extra configuration in
> "tmux.conf", or do I need to create a separate file ("mywindows.conf")
> that I instruct tmux of via some other argument, or how?
> 
> And what should the commands be.
> 
> 
> Of course creating the windows and starting the processes should happen
> only at the initial "tmux -u new -t main" run which starts the first
> tmux OS process, not on subsequent "tmux -u new -t main" calls which
> reattach to the already existing tmux or add a concurrent terminal to
> access the already existing tmux.
> 
> Thanks,
> Joseph

Hello,

I use a script which create a named session, split the windows, choose a pane,
send keys to start a command, split again etc...

Here is my script:

#!/bin/sh
SESSION=tor
tmux -2 new-session -d -s $SESSION
tmux split-window -v
tmux select-pane -t 0
tmux send-keys "vnstat -l -ru" C-m
tmux split-window -h
tmux select-pane -t 1
tmux send-keys "while true ; do clear ; vnstat -ru -h ; sleep 120 ; done" C-m
tmux select-pane -t 2
tmux send-keys "systat rules" C-m
tmux attach

Reply via email to