From da8179ab6f7aa2fa45613f931a03eb0698025533 Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Sat, 28 Feb 2026 19:09:14 -0600 Subject: [PATCH] Switch to tmuxp for layout management, add C-f C-g tmux commands to switch mobile/full layout --- .gitignore | 1 + Discworld | 62 +++++++++----------------------------------------- discworld.yaml | 16 +++++++++++++ 3 files changed, 28 insertions(+), 51 deletions(-) create mode 100644 discworld.yaml diff --git a/.gitignore b/.gitignore index c4cbf75..ace48a8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ src/constants.tin src/timer.tin src/testing.tin src/gems.tin +bin/watcher diff --git a/Discworld b/Discworld index fa80b1d..508acfa 100755 --- a/Discworld +++ b/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 diff --git a/discworld.yaml b/discworld.yaml new file mode 100644 index 0000000..748003d --- /dev/null +++ b/discworld.yaml @@ -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