tmux #

I get weird about multiple tabs and splits in my workflow, and I really like to have the same layout across #tmux sessions.

In the distant-in-dog-years past, I spend too many hours building custom layout templates, etc, but have since given up tmux as a hobby. Now, I just hit prefix and then smash <SPACE> until the layout looks nice enough.

However... When I have a giant screen, e.g. 3840 x 2160, the layouts look weird to me. So, back to scripting:

#!/bin/bash
# $HOME/.config/tmux/big-split.sh

TERMINAL_WIDTH=$(tmux display-message -p "#{window_width}")
TERMINAL_HEIGHT=$(tmux display-message -p "#{window_height}")
PERCENTAGE=70
OFFSET=10
PANE_WIDTH=$((TERMINAL_WIDTH * PERCENTAGE / 100 + OFFSET))

tmux split-window -h -l "$PANE_WIDTH"

Then a small amendment to tmux.conf so that I can set the layout with :bigsplit:

# $HOME/.config/tmux/tmux.conf

set -g command-alias[0] bigsplit="run-shell '$HOME/.config/tmux/big-split.sh'"

this is my terminal