all repos

tmux-stare @ aebb6c8

session manager, but my session manager
4 files changed, 17 insertions(+), 12 deletions(-)
fix picker opening on start
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-06-03 17:23:50 +0300
Authored at: 2026-05-31 11:27:34 +0300
Change ID: yvkyvkopplyypwllywtyssyslrtksoun
Parent: 561d729
M scripts/_pick.sh
···
        1
        1
         #!/usr/bin/env bash

      
        2
        2
         CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

      
        
        3
        +source "$CURRENT_DIR/helpers.sh"

      
        
        4
        +

      
        
        5
        +wait_for_client

      
        3
        6
         tmux display-popup -E -w 25% -h 50% "$CURRENT_DIR/pick.sh"

      
M scripts/_restore.sh
···
        2
        2
         CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

      
        3
        3
         source "$CURRENT_DIR/sessions.sh"

      
        4
        4
         

      
        
        5
        +wait_for_client

      
        5
        6
         restore_last

      
M scripts/helpers.sh
···
        
        1
        +get_time() { date +"%Y%m%dT%H%M%S"; }

      
        1
        2
         get_tmux_option() {

      
        2
        3
           local option="$1"

      
        3
        4
           local default_value="$2"

      ···
        15
        16
           tmux set-option -gq "$option" "$value"

      
        16
        17
         }

      
        17
        18
         

      
        18
        
        -get_time() { date +"%Y%m%dT%H%M%S"; }

      
        
        19
        +wait_for_client() {

      
        
        20
        +  local i=0

      
        
        21
        +  while [ "$i" -lt 100 ]; do

      
        
        22
        +    if tmux list-clients >/dev/null 2>&1; then break; fi

      
        
        23
        +    sleep 0.1

      
        
        24
        +    i=$((i + 1))

      
        
        25
        +  done

      
        
        26
        +}

      
        19
        27
         

      
        20
        28
         # === options

      
        21
        29
         get_opt_interval() { get_tmux_option "@stare-interval" "15"; }

      
        22
        30
         get_opt_start() { get_tmux_option "@stare-start" ""; }

      
        23
        31
         get_opt_last() { get_tmux_option "@stare-last" "0"; }

      
        24
        32
         set_opt_last() { set_tmux_option "@stare-last" "$1"; }

      
        25
        
        -get_opt_initialized() { get_tmux_option "@stare-initialized" "0"; }

      
        26
        
        -set_opt_initialized() { set_tmux_option "@stare-initialized" "$1"; }

      
        27
        33
         get_opt_save() { get_tmux_option "@stare-save" "C-s"; }

      
        28
        34
         get_opt_pick() { get_tmux_option "@stare-pick" ""; }

      
        29
        35
         get_opt_processes() { get_tmux_option "@stare-processes" "vi vim nvim man less more tial htop btop claude opencode copilot pi"; }

      
M stare.tmux
···
        1
        1
         #!/usr/bin/env bash

      
        2
        
        -set -x

      
        3
        2
         

      
        4
        3
         CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

      
        5
        4
         source "$CURRENT_DIR/scripts/helpers.sh"

      ···
        21
        20
           [[ -n "$save_key" ]] && tmux bind-key "$save_key" run-shell "$CURRENT_DIR/scripts/_save.sh"

      
        22
        21
         

      
        23
        22
           local start_action="$(get_opt_start)"

      
        24
        
        -  if [[ "$(get_opt_initialized)" == "0" ]]; then

      
        25
        
        -    if [[ "$start_action" == "last" ]]; then

      
        26
        
        -      tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_restore.sh'"

      
        27
        
        -    elif [[ "$start_action" == "pick" ]]; then

      
        28
        
        -      tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_pick.sh'"

      
        29
        
        -    fi

      
        30
        
        -

      
        31
        
        -    set_opt_initialized "1"

      
        
        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'"

      
        32
        27
           fi

      
        33
        28
         

      
        34
        29
           add_save_interpolation