From 2249cf8d1be87c0b1be9546b40eead70733e68c0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 20 Jun 2014 15:35:52 +0200 Subject: [PATCH] new_window: only set $window and pass `-n` if a name is provided Otherwise `new_window` after `new_window foo` would re-use the same name, resulting in an error. --- lib/layout-helpers.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index bac4cd9..703f8c8 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -18,9 +18,11 @@ tmux() { # - $2: (optional) Shell command to execute when window is created. # new_window() { - if [ -n "$1" ]; then window="$1"; fi + if [ -n "$1" ]; then + window="$1" + local winarg=(-n "$window") + fi if [ -n "$2" ]; then local command=("$2"); fi - if [ -n "$window" ]; then local winarg=(-n "$window"); fi tmuxifier-tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}" __go_to_window_or_session_path