From fee18d99557e0f785b8e4c251bb01be7572371fc Mon Sep 17 00:00:00 2001 From: Nigel Greenway Date: Sat, 18 Oct 2025 14:56:00 +0100 Subject: [PATCH] fix: removes ../ and - from tmux window name Window name will name appear as "my worktree name" instead of "../my-worktree-name". fixes: #8 --- src/main | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main b/src/main index ef49bc1..fdb9cc6 100755 --- a/src/main +++ b/src/main @@ -83,9 +83,11 @@ if [[ "$is_root_of_repo" -eq 0 ]]; then directory="../$directory" fi +window_name=$(echo "$directory" | sed 's/\.\.\///g' | sed 's/-/ /g') + if [[ -d "$directory" ]]; then abs_directory=$(cd "$directory" && pwd) - if ! tmux new-window -c "$abs_directory" -n "$directory"; then + if ! tmux new-window -c "$abs_directory" -n "$window_name"; then echo "Error: Failed to create tmux window" read -n 1 -s -r -p "Press any key to close..." exit 1 @@ -108,7 +110,7 @@ else fi abs_directory=$(cd "$directory" && pwd) -if ! tmux new-window -c "$abs_directory" -n "$directory"; then +if ! tmux new-window -c "$abs_directory" -n "$window_name"; then echo "Error: Failed to create tmux window" read -n 1 -s -r -p "Press any key to close..." exit 1