From f305cc31d784a621c0b22bc2eda71456f40e5641 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 25 Apr 2012 23:03:41 +0100 Subject: [PATCH] Update new_window helper's handling of window name and init command New behavior of `new_window` helper: - When no argument is specified no specific window name is set. - Second argument added to pass a shell command to be executed. If a shell command is needed, but no window name is desired, pass an empty string `""` as the first argument. --- layout-helpers.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/layout-helpers.sh b/layout-helpers.sh index 7b311a5..3ad49ee 100644 --- a/layout-helpers.sh +++ b/layout-helpers.sh @@ -11,7 +11,13 @@ new_window() { if [ ! -z "$1" ]; then window="$1" fi - tmux new-window -t "$session:" -n "$window" + if [ ! -z "$2" ]; then + local command="\"$2\"" + fi + if [ ! -z "$window" ]; then + local winarg="-n \"$window\"" + fi + eval "tmux new-window -t \"$session:\" $winarg $command" } # Load specified window layout.