Files
tmuxifier/libexec/tmuxifier-load-window

41 lines
811 B
Bash
Executable File

#! /usr/bin/env bash
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
# Load internal utility functions.
source "$TMUXIFIER/lib/util.sh"
# Provide tmuxifier help
if calling-help "$@"; then
echo "usage: tmuxifier load-window <layout_name>
Aliases: window, win, w
Create a new window using the specified window layout in the current session."
exit
fi
# Provide tmuxifier completions
if calling-complete "$@"; then
for item in $(tmuxifier-list-windows); do
echo "$item"
done
exit
fi
if [ -z "$1" ]; then
echo "$(tmuxifier-help load-window)" >&2
exit 1
fi
# Load runtime functions.
source "$TMUXIFIER/lib/runtime.sh"
if [ ! -z $TMUX ]; then
session="$(tmuxifier-current-session)"
load_window "$1"
else
echo "tmuxifier: 'load-window' command can only be used from within Tmux."
exit 1
fi