Created
March 15, 2021 13:35
-
-
Save angel-rs/5f92a9497f08649279b9beb0ab9c6727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
prefix=$(echo "$1" | tr '[:upper:]' '[:lower:]') | |
run_command_on_panel () { | |
local workspace_name=$1 | |
local command_to_run=$2 | |
local panel_number="${3:0}" | |
tmux send-keys -t $workspace_name.$panel_number "$command_to_run" ENTER | |
} | |
case $prefix in | |
project1) | |
workspace="project1" | |
tmux new -d -s $workspace; | |
run_command_on_panel $workspace "echo 'setup panel 1'" "0"; | |
tmux split-window -v; | |
run_command_on_panel $workspace "echo 'setup panel 2'" "1"; | |
tmux select-pane -t 0; | |
tmux split-window -h; | |
tmux select-pane -t 1; | |
run_command_on_panel $workspace "echo 'setup panel 3'" "1"; | |
tmux select-pane -t 2; | |
tmux split-window -h; | |
run_command_on_panel $workspace "echo 'setup panel 4'" "3"; | |
tmux select-pane -t 0; | |
tmux attach -t $workspace; | |
;; | |
*) | |
echo "couldn't find a workspace with that name." | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment