I have been looking at sysutils/tmux but am unable to figure out if I can start it initially with three windows with an autostart program in each.
Can anyone advise?
Can anyone advise?
tmux new-session -d "cmd1"; tmux new-window "cmd2"; tmux new-window "cmd3"; tmux a tmux. You will also assign it a pane number so you can attach and detach from it or where it is positioned in your screen arrangement.
#!/bin/bash
# Prerequisites: brew install tmux redis
# Set Session Name
SESSION="Redis local cluster"
SESSIONEXISTS=$(tmux list-sessions 2> /dev/null | grep "$SESSION")
if [ $(uname -p) = "arm" ]
then
BINPATH="/opt/homebrew/bin"
else
BINPATH="/usr/local/bin"
fi
CONFIGPATH=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
# Only create tmux session if it doesn't already exist
if [ "$SESSIONEXISTS" = "" ]
then
# Start New Session with our name
tmux new-session -d -s "$SESSION"
tmux send-keys "cd $CONFIGPATH/7001" C-m "$BINPATH/redis-server $CONFIGPATH/7001/redis.conf" C-m
CLUSTERCMD="redis-cli --cluster create 127.0.0.1:7001 "
for i in $(seq 2 6)
do
tmux split-window -t "$SESSION"
tmux send-keys -t "$SESSION" "cd $CONFIGPATH/700$i" C-m "$BINPATH/redis-server $CONFIGPATH/700$i/redis.conf" C-m
tmux select-layout -t "$SESSION" tiled
CLUSTERCMD="$CLUSTERCMD 127.0.0.1:700$i "
done
CLUSTERCMD="$CLUSTERCMD --cluster-replicas 1"
echo $CLUSTERCMD
echo "Run the command above to create the cluster. Only has to be run once."
fi
# Attach Session, on the Main window
tmux attach-session -t "$SESSION"
I think an overview of the key bindings for copy-paste along with some examples of interaction with the system clipboard are required since its a must have feature for anyone using tmux in a productive workflow.
#!/usr/bin/env sh
tmux new-session -d emacs -nw
tmux new-window -d ncdu
#tmux split-window -h emacs -nw
tmux new-window -d mc
#tmux split-window
tmux new-window -d 'env SHELL=/usr/local/bin/bash mc'
tmux attach
Personally, I am struggling to master tmux and wished it was the first thing I learnt when I started playing with FreeBSD ten years ago. It would have save me so much time. I would advise anyone starting out with FreeBSD to learn tmux and Doom Emacs as a priority.I use xfce workspaces each with several running xfce-terminals, which I may bring to full screen with F11 key. Some of these xfce-terminal sessions being attached to other devices via ssh have tmux sessions running. I've wondered if it wouldn't be more efficient to open them all in one tmux and use it to do the switching and windowing instead of xfce. I've not yet successfully penetrated the intricacies of tmux and tend to quit when things like copy and paste don't work quite exactly as I've become accustomed.