all repos

tmux-stare @ dee3c28

session manager, but my session manager

tmux-stare/stare.tmux (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
fix picker opening on start, 3 days ago
1
#!/usr/bin/env bash
2
3
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
source "$CURRENT_DIR/scripts/helpers.sh"
5
6
add_save_interpolation() {
7
  local status_right_value="$(get_tmux_option "status-right" "")"
8
  local save_interpolation="#($CURRENT_DIR/scripts/_auto_save.sh)"
9
10
  if [[ "$status_right_value" != *"$save_interpolation"* ]]; then
11
    set_tmux_option "status-right" "${save_interpolation}${status_right_value}"
12
  fi
13
}
14
15
main() {
16
  local pick_key="$(get_opt_pick)"
17
  [[ -n "$pick_key" ]] && tmux bind-key "$pick_key" run-shell "$CURRENT_DIR/scripts/_pick.sh"
18
19
  local save_key="$(get_opt_save)"
20
  [[ -n "$save_key" ]] && tmux bind-key "$save_key" run-shell "$CURRENT_DIR/scripts/_save.sh"
21
22
  local start_action="$(get_opt_start)"
23
  if [[ "$start_action" == "last" ]]; then
24
    tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_restore.sh'"
25
  elif [[ "$start_action" == "pick" ]]; then
26
    tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_pick.sh'"
27
  fi
28
29
  add_save_interpolation
30
}
31
main