diff options
author | Cody Hiar <codyfh@gmail.com> | 2017-04-25 11:54:01 -0600 |
---|---|---|
committer | Cody Hiar <codyfh@gmail.com> | 2017-04-25 11:54:01 -0600 |
commit | 15659c5bac16417cdece907c775359e1d5d81b42 (patch) | |
tree | bd56a46f87300433324d303d443f4e1f21d2b8eb /scripts/bottom_window_drawer.sh | |
parent | b31357b40b3ad7101e78366b923e22833cb649d1 (diff) |
Updating for bottom drawer functionality
Diffstat (limited to 'scripts/bottom_window_drawer.sh')
-rwxr-xr-x | scripts/bottom_window_drawer.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/bottom_window_drawer.sh b/scripts/bottom_window_drawer.sh new file mode 100755 index 0000000..7c3dcaf --- /dev/null +++ b/scripts/bottom_window_drawer.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# vim: set filetype=sh : +# +# Author: Cody Hiar +# Date: 2017-04-25 +# +# Purpose: To either close or open a bottom drawer window +# +# Set options: +# e: Stop script if command fails +# u: Stop script if unset variable is referenced +# x: Debug, print commands as they are executed +set -eu + +# Immutable globals +readonly ARGS=( "$@" ) +readonly PROGNAME=$(basename "$0") + +# Main loop of program +main() { + NUM_PANES=$(tmux list-panes | wc -l) + if [[ "$NUM_PANES" == 1 ]]; then + tmux split-window -c '#{pane_current_path}' + tmux resize-pane -t 2 -y 20 + else + tmux kill-pane -t 2 + fi +} +main |