aboutsummaryrefslogtreecommitdiff
path: root/broot-sessionizer/menu.sh
blob: f18799200ca39ce7c9f74a587e82214458139ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)

get_nth_session() {
  tmux list-sessions -F "#{session_name}" | sed -n "$1 p"
}

switch_nth_session() {
  printf "switch -t $(get_nth_session "$1")"
}

tmux display-menu -T "#[align=centre]Projects" -x "#{window_width}" -y S \
  "Switch Project" p "run-shell '$SCRIPT_DIR/../minibuffer.sh -d $HOME $SCRIPT_DIR/launch.sh'" \
  "$(get_nth_session 1)" 1 "$(switch_nth_session 1)" \
  "$(get_nth_session 2)" 2 "$(switch_nth_session 2)" \
  "$(get_nth_session 3)" 3 "$(switch_nth_session 3)" \
  "$(get_nth_session 4)" 4 "$(switch_nth_session 4)"