Files
tmuxifier/libexec/tmuxifier-load-window
Jim Myhrberg 1dddbb502c Enable load commands to accept file paths in addition to layout names
Resolves issue #20. Additionally, load_session now has an optional
second argument to set the default session name. And error output from
both load commands is now printed to STDERR and give a return code of 1
on error.
2013-07-02 23:05:18 +02:00

39 lines
783 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 | file_path>
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
tmuxifier-list-windows
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