6 files changed,
29 insertions(+),
4 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-02-09 18:04:17 +0200
Authored at:
2026-02-09 16:04:10 +0200
Change ID:
lrppslvqpwyropotwwwxrtzrtxlwpxtz
Parent:
00e1679
jump to
| M | readme |
| A | scripts/_pick.sh |
| A | scripts/_restore.sh |
| M | scripts/_save.sh |
| M | scripts/helpers.sh |
| M | stare.tmux |
M
readme
··· 32 32 # Default: 'C-s' 33 33 set -g @stare-save 'C-s' 34 34 35 + # Start action. 'pick' opens picker on start, 'last' restores last session 36 + # Default: '' 37 + set -g @stare-start '' 38 + 35 39 # Auto-save interval in minutes. Set to '0' to disable. 36 40 # Default: '10' 37 41 set -g @stare-interval '10' ··· 44 48 45 49 Things I might add in the future. 46 50 47 - - Start up action (automatically open picker/restore last session) 48 51 - Resurrect of vim with ':mksession' 49 52 - Keep content of panes 50 53
A
scripts/_pick.sh
··· 1 +#!/usr/bin/env bash 2 +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 3 +tmux display-popup -E -w 25% -h 40% "$CURRENT_DIR/pick.sh"
M
scripts/helpers.sh
··· 18 18 get_time() { date +"%Y%m%dT%H%M%S"; } 19 19 20 20 # === options 21 -get_opt_interval() { get_tmux_option "@stare-interval" "10"; } 21 +get_opt_interval() { get_tmux_option "@stare-interval" "15"; } 22 +get_opt_start() { get_tmux_option "@stare-start" ""; } 22 23 get_opt_last() { get_tmux_option "@stare-last" "0"; } 23 24 set_opt_last() { set_tmux_option "@stare-last" "$1"; } 25 +get_opt_initialized() { get_tmux_option "@stare-initialized" "0"; } 26 +set_opt_initialized() { get_tmux_option "@stare-initialized" "$1"; } 24 27 get_opt_save() { get_tmux_option "@stare-save" "C-s"; } 25 28 get_opt_pick() { get_tmux_option "@stare-pick" ""; } 26 29 get_opt_dir() {
M
stare.tmux
··· 15 15 16 16 main() { 17 17 local pick_key="$(get_opt_pick)" 18 - [[ -n "$pick_key" ]] && tmux bind-key "$pick_key" run-shell \ 19 - "tmux display-popup -E -w 25% -h 40% '$CURRENT_DIR/scripts/pick.sh'" 18 + [[ -n "$pick_key" ]] && tmux bind-key "$pick_key" run-shell "$CURRENT_DIR/scripts/_pick.sh" 20 19 21 20 local save_key="$(get_opt_save)" 22 21 [[ -n "$save_key" ]] && tmux bind-key "$save_key" run-shell "$CURRENT_DIR/scripts/_save.sh" 22 + 23 + local start_action="$(get_opt_start)" 24 + local is_initialized="$(get_opt_initialized)" 25 + if [[ "$is_initialized" =~ "1" ]]; then 26 + if [[ "$start_action" == "last" ]]; then 27 + tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_restore.sh'" 28 + elif [[ "$start_action" == "pick" ]]; then 29 + tmux run-shell -b "sleep 0.1 && '$CURRENT_DIR/scripts/_pick.sh'" 30 + fi 31 + fi 23 32 24 33 add_save_interpolation 25 34 }