Debian Codegraph @

examples/tmux_split.sh

raw symbols SCIP
1 #!/usr/bin/env zsh
2
3 # This script launches two applications using byobu in different tabs.
4 # The user is required to enter the name of at least the first application.
5 # If the second isn't provided, then the user's default shell is launched for this.
6 #
7 # byobu must be installed for this script to work and you can install it using your
8 # operating system package manager. For info on how to use Byobu, see: https://www.byobu.org/
9 #
10 # To shift focus between tabs in byobu, just hit F3.
11
12 # Function to print in red
13 print_red() {
14 echo -e "\e[31m$*\e[0m"
15 }
16
17 if [ $# -eq 0 ];
18 then
19 print_red "No arguments supplied and this script requires at least one"
20 exit 1
21 fi
22
23 FIRST_COMMAND=$1
24
25 if [ $# -eq 1 ]
26 then
27 SECOND_COMMAND=$SHELL
28 else
29 SECOND_COMMAND=$2
30 fi
31
32 tmux new-session -s "tmux split pane demo" "$FIRST_COMMAND ; read" \; \
33 split-window "$SECOND_COMMAND ; read" \; \
34 select-layout even-vertical