summaryrefslogtreecommitdiff
path: root/scripts/tmux-session-setup
blob: be51ad67092b1705d24758bf24a5b89750e1dbd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash

sess=$1
dir=$2

if [ "$dir" = "$HOME" ]; then
  tmux rename-window -t $sess:1 main
  tmux send-keys -t $sess:main.1 "fastfetch" C-m
elif [ "$sess" = "eko" ]; then
  tmux rename-window -t $sess:1 editor
  tmux send-keys -t $sess:editor.1 "vim" C-m

  tmux new-window -t $sess -n app -c $dir
  tmux split-window -t $sess:app.1 -v -c $dir
  tmux send-keys -t $sess:app.2 "watchexec --exts=go './reload.sh'" C-m
  tmux resize-pane -Z -t $sess:app.1

  tmux new-window -t $sess -n logs -c $dir
  tmux split-window -t $sess:logs.1 -h -c $dir
  tmux split-window -t $sess:logs.2 -v -c $dir
  tmux send-keys -t $sess:logs.1 "tail -f messages.log" C-m
  tmux send-keys -t $sess:logs.2 "tail -f client.log" C-m
  tmux send-keys -t $sess:logs.3 "go run ./cmd/server --stdout" C-m

  tmux select-window -t $sess:editor
elif [[ "$dir" == "$HOME/projects/"* ]]; then
  tmux rename-window -t $sess:1 editor
  tmux send-keys -t $sess:editor.1 "vim" C-m
fi