Skip to content

Instantly share code, notes, and snippets.

@apolopena
Created August 6, 2021 20:15
Show Gist options
  • Save apolopena/aeebeba94c09e0a6bee0b79cb391f604 to your computer and use it in GitHub Desktop.
Save apolopena/aeebeba94c09e0a6bee0b79cb391f604 to your computer and use it in GitHub Desktop.
tmux proof of concept for opening up a split pane window session with a series of synchronized commands
#!/bin/bash
#
# proof of concept: scripted tmux
# opens a 2 pane tmux session with rainbows fortunes
# marks the window status red because the panes are synchronized
# and then closes it all down
main() {
tmux new-session \;\
setw -g window-status-current-format '#{?pane_synchronized,#[bg=red],}#I:#W' \;\
setw -g window-status-format '#{?pane_synchronized,#[bg=red],}#I:#W' \;\
split-window -vd\;\
rename-window "🔮zsh - fortunes" \;\
set-window-option synchronize-panes on \;\
send-keys 'fortune | cowsay | lolcat' C-m \;\
send-keys 'sleep 10' C-m \;\
send-keys 'exit' C-m;
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment