aboutsummaryrefslogtreecommitdiff
path: root/scripts/bottom_window_drawer.sh
blob: 7c3dcaf438fd73b411989d9ae2bc90ec1007aebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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