all repos

tmux-stare @ 2435b5ef3077aaee19237439c9ee8b671a6bc236

session manager, but my session manager
6 files changed, 29 insertions(+), 4 deletions(-)
@stare-start
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-09 18:04:17 +0200
Change ID: lrppslvqpwyropotwwwxrtzrtxlwpxtz
Parent: 00e1679
M readme

@@ -32,6 +32,10 @@ # Bind for manually triggering save of all sessions.

# Default: 'C-s' set -g @stare-save 'C-s' + # Start action. 'pick' opens picker on start, 'last' restores last session + # Default: '' + set -g @stare-start '' + # Auto-save interval in minutes. Set to '0' to disable. # Default: '10' set -g @stare-interval '10'

@@ -44,7 +48,6 @@ FUTURE

Things I might add in the future. - - Start up action (automatically open picker/restore last session) - Resurrect of vim with ':mksession' - Keep content of panes
A scripts/_pick.sh

@@ -0,0 +1,3 @@

+#!/usr/bin/env bash +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +tmux display-popup -E -w 25% -h 40% "$CURRENT_DIR/pick.sh"
A scripts/_restore.sh

@@ -0,0 +1,5 @@

+#!/usr/bin/env bash +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$CURRENT_DIR/sessions.sh" + +restore_last
M scripts/_save.sh

@@ -3,4 +3,6 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source "$CURRENT_DIR/helpers.sh" source "$CURRENT_DIR/sessions.sh" +start_spinner "Saving sessions" save_all_sessions +stop_spinner "Sassions saved"
M scripts/helpers.sh

@@ -18,9 +18,12 @@

get_time() { date +"%Y%m%dT%H%M%S"; } # === options -get_opt_interval() { get_tmux_option "@stare-interval" "10"; } +get_opt_interval() { get_tmux_option "@stare-interval" "15"; } +get_opt_start() { get_tmux_option "@stare-start" ""; } get_opt_last() { get_tmux_option "@stare-last" "0"; } set_opt_last() { set_tmux_option "@stare-last" "$1"; } +get_opt_initialized() { get_tmux_option "@stare-initialized" "0"; } +set_opt_initialized() { get_tmux_option "@stare-initialized" "$1"; } get_opt_save() { get_tmux_option "@stare-save" "C-s"; } get_opt_pick() { get_tmux_option "@stare-pick" ""; } get_opt_dir() {
M stare.tmux

@@ -15,11 +15,20 @@ }

main() { local pick_key="$(get_opt_pick)" - [[ -n "$pick_key" ]] && tmux bind-key "$pick_key" run-shell \ - "tmux display-popup -E -w 25% -h 40% '$CURRENT_DIR/scripts/pick.sh'" + [[ -n "$pick_key" ]] && tmux bind-key "$pick_key" run-shell "$CURRENT_DIR/scripts/_pick.sh" local save_key="$(get_opt_save)" [[ -n "$save_key" ]] && tmux bind-key "$save_key" run-shell "$CURRENT_DIR/scripts/_save.sh" + + local start_action="$(get_opt_start)" + local is_initialized="$(get_opt_initialized)" + if [[ "$is_initialized" =~ "1" ]]; then + if [[ "$start_action" == "last" ]]; then + tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_restore.sh'" + elif [[ "$start_action" == "pick" ]]; then + tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_pick.sh'" + fi + fi add_save_interpolation }