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.
This commit is contained in:
2012-04-25 23:03:41 +01:00
parent 1cd0c33333
commit f305cc31d7

View File

@@ -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.