TinTin++ Configs for DiscworldMUD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9 KiB

6 years ago
6 years ago
6 years ago
  1. cd ~/documents/MUD/Discworld
  2. # No existing discworld session? Then create one
  3. if [[ ! $(tmux ls -F '#S') =~ discworld ]]; then
  4. # Flag that we've just created a session
  5. DISC_SESSION_CREATE=1
  6. # Zero out log files to keep size down
  7. # rm logs/minimap.log && touch logs/minimap.log
  8. # rm logs/mapdoortext.log && touch logs/mapdoortext.log
  9. # rm logs/chat.log && touch logs/chat.log
  10. # Start a new tmux session named "discworld"
  11. tmux new-session -d -A -D -s discworld
  12. fi
  13. # If we're in TMUX, or we just created a new session, make a layout
  14. if [ -n "$TMUX" ] || [ "$DISC_SESSION_CREATE" = "1" ]; then
  15. # Kill any existing panes but the one we're "starting" in if in tmux already
  16. if [ -n "$TMUX" ]; then
  17. tmux kill-pane -a -t discworld:0.0
  18. fi
  19. # Create the chat monitor window on top
  20. tmux split-window -v -b -l 4
  21. tmux send-keys 'clear && tail -fs .5 logs/chat.log' 'C-m'
  22. # Did we ask for the full layout?
  23. if [[ $1 == "full" ]]; then
  24. # Horizontal split and load spottimers
  25. tmux select-pane -t discworld:0.0
  26. tmux split-window -h -l 28
  27. tmux send-keys './bin/dt' 'C-m'
  28. # Splice a section for group shield monitor
  29. tmux split-window -v -p 50
  30. tmux send-keys './bin/grp' 'C-m'
  31. # Place the ASCII map at the bottom
  32. tmux split-window -v -p 50
  33. tmux send-keys './bin/map' 'C-m'
  34. fi
  35. # Cut back to main window, vertical split for mapdoortext
  36. tmux select-pane -t discworld:0.0
  37. tmux split-window -v -b -l 5
  38. tmux send-keys './bin/mdt' 'C-m'
  39. # Select main pane again and load TinTin++ with our config
  40. tmux select-pane -t discworld:0.0
  41. tmux send-keys 'clear && tt++ -G config.tin' 'C-m'
  42. fi
  43. if [ -z "$TMUX" ]; then
  44. echo "Not already in TMUX, so let's attach"
  45. # If we aren't already inside of TMUX, then attach to our session
  46. tmux -2 attach-session -t discworld -d
  47. fi