File: tmux_split.sh

package info (click to toggle)
cmd2 2.5.11%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,244 kB
  • sloc: python: 19,643; makefile: 73; sh: 67; javascript: 30
file content (34 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (2)
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
30
31
32
33
34
#!/usr/bin/env zsh

# This script launches two applications using byobu in different tabs.
# The user is required to enter the name of at least the first application.
# If the second isn't provided, then the user's default shell is launched for this.
#
# byobu must be installed for this script to work and you can install it using your
# operating system package manager. For info on how to use Byobu, see: https://www.byobu.org/
#
# To shift focus between tabs in byobu, just hit F3.

# Function to print in red
print_red() {
    echo -e "\e[31m$*\e[0m"
}

if [ $# -eq 0 ];
  then
    print_red  "No arguments supplied and this script requires at least one"
    exit 1
fi

FIRST_COMMAND=$1

if [ $# -eq 1 ]
  then
    SECOND_COMMAND=$SHELL
  else
    SECOND_COMMAND=$2
fi

tmux new-session -s "tmux split pane demo" "$FIRST_COMMAND ; read" \; \
  split-window "$SECOND_COMMAND ; read" \; \
  select-layout even-vertical