From 8b056316455d6247d1f794e1b782cf02c35703d9 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sun, 19 Nov 2023 11:16:19 +0100 Subject: [PATCH] feat(tmux): Add spinner to project opener --- .bin/tmux-projectinator | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.bin/tmux-projectinator b/.bin/tmux-projectinator index 247ed6b..2b00ef6 100755 --- a/.bin/tmux-projectinator +++ b/.bin/tmux-projectinator @@ -23,6 +23,16 @@ debug () { fi } +spinner() { + local s="⣾⣽⣻⢿⡿⣟⣯⣷" + local -i i=0 + while :; do + printf "%s\\r" "${s:$((i++%4)):1}" >&2 + sleep .1 + done + +} + open_local () { tmux send-keys "cd $PROJECT_PATH" Enter @@ -52,7 +62,12 @@ open_new_pane () { declare -A CUSTOM_SESSIONS CUSTOM_SESSIONS[Projects]=Halia -PROJECT_LIST=$(find ~/* -name .git -type d -prune 2>/dev/null) +spinner & +spinner_pid=$! + +PROJECT_LIST=$(find ~/* -name .git -type d -not -path "~/.*" -prune 2>/dev/null) + +kill $spinner_pid SELECTED=$(echo $PROJECT_LIST | sed 's/\/.git/\n/g' | sed "s/$(echo $HOME | sed 's/\//\\\//g')//" | cut -d'/' -f2- | fzf)