Switch to tmuxp for layout management, add C-f C-g tmux commands to switch mobile/full layout
This commit is contained in:
parent
81b3f373d5
commit
da8179ab6f
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@ src/constants.tin
|
||||
src/timer.tin
|
||||
src/testing.tin
|
||||
src/gems.tin
|
||||
bin/watcher
|
||||
|
||||
62
Discworld
62
Discworld
@ -1,66 +1,26 @@
|
||||
cd "$(dirname '$0')"
|
||||
# Change to the 'discworld-tintin' directory and remove the input history file
|
||||
cd "$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
rm logs/history.log
|
||||
|
||||
# Set hotkeys to switch in/out of "mobile" mode
|
||||
tmux bind C-f resize-pane -x 80%
|
||||
tmux bind C-g resize-pane -x 100%
|
||||
|
||||
# No existing discworld session? Then create one
|
||||
if [[ ! $(tmux ls -F '#S') =~ discworld ]]; then
|
||||
# Flag that we've just created a session
|
||||
DISC_SESSION_CREATE=1
|
||||
|
||||
# Zero out log files to keep size down
|
||||
# rm logs/minimap.log && touch logs/minimap.log
|
||||
# rm logs/mapdoortext.log && touch logs/mapdoortext.log
|
||||
# rm logs/chat.log && touch logs/chat.log
|
||||
rm logs/chat.log && touch logs/chat.log
|
||||
|
||||
# Start a new tmux session named "discworld"
|
||||
tmux new-session -d -A -D -s discworld
|
||||
fi
|
||||
|
||||
# If we're in TMUX, or we just created a new session, make a layout
|
||||
if [ -n "$TMUX" ] || [ "$DISC_SESSION_CREATE" = "1" ]; then
|
||||
|
||||
# Kill any existing panes but the one we're "starting" in if in tmux already
|
||||
if [ -n "$TMUX" ]; then
|
||||
tmux kill-pane -a -t discworld:0.0
|
||||
fi
|
||||
|
||||
# Create the chat monitor window on top
|
||||
echo "Making chat monitor window"
|
||||
#tmux split-window -v -b -l 4
|
||||
tmux split-window -v -b -l 4
|
||||
tmux send-keys 'clear && tail -fs .5 logs/chat.log' 'C-m'
|
||||
|
||||
# Did we ask for the full layout?
|
||||
if [[ $1 == "full" ]]; then
|
||||
# Horizontal split and load spottimers
|
||||
echo "Making death timer window"
|
||||
tmux select-pane -t discworld:0.1
|
||||
tmux split-window -h -l 28
|
||||
tmux send-keys './bin/dt' 'C-m'
|
||||
|
||||
# Splice a section for group shield monitor
|
||||
echo "Making group shield window"
|
||||
tmux split-window -v -p 50
|
||||
tmux send-keys './bin/grp' 'C-m'
|
||||
|
||||
# Place the ASCII map at the bottom
|
||||
echo "Making map window"
|
||||
tmux split-window -v -p 50
|
||||
tmux send-keys './bin/map' 'C-m'
|
||||
fi
|
||||
|
||||
# Cut back to main window, vertical split for mapdoortext
|
||||
echo "Making MDT window"
|
||||
tmux select-pane -t discworld:0.0
|
||||
#tmux split-window -v -b -l 5
|
||||
tmux split-window -v -l 1
|
||||
tmux send-keys './bin/mdt' 'C-m'
|
||||
|
||||
# Select main pane again and load TinTin++ with our config
|
||||
tmux select-pane -t discworld:0.1
|
||||
tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
||||
# Start a new tmux session named "discworld" with our tmuxp setup
|
||||
tmuxp load -s discworld ./discworld2.yaml
|
||||
fi
|
||||
|
||||
# If there is already a session, just attach
|
||||
if [ -z "$TMUX" ]; then
|
||||
#tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
|
||||
echo "Not already in TMUX, so let's attach"
|
||||
# If we aren't already inside of TMUX, then attach to our session
|
||||
tmux -2 attach-session -t discworld -d
|
||||
|
||||
16
discworld.yaml
Normal file
16
discworld.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
session_name: discworld
|
||||
windows:
|
||||
- focus: 'true'
|
||||
layout: 459d,144x79,0,0[144x8,0,0,289,144x10,0,9,290,144x59,0,20{116x59,0,20,291,27x59,117,20[27x38,117,20,292,27x10,117,59,293,27x9,117,70,294]}]
|
||||
options: {}
|
||||
panes:
|
||||
- tail
|
||||
- sh
|
||||
- focus: 'true'
|
||||
shell_command: tt++
|
||||
- bash
|
||||
- sh
|
||||
- bash
|
||||
start_directory: "$(dirname '$0')"
|
||||
window_name: DiscworldMUD
|
||||
Loading…
x
Reference in New Issue
Block a user