Skip to main content

Tmux Start Session Maximized With Three Panes

So I got tired of starting up a dedicated tmux session to manage all the work related to my writing sessions. Over the past few months, I’ve boiled it down to three.
And it still irks me that I have to …

  1. Launch Terminal
  2. Launch Tmux
  3. Split it into three windows err … panes.
  4. Go to the top left pane and launch Hugo server
  5. Switch to the right pane and then launch Emacs with whatever new post I want to write today.

So of course, a Rube Goldberg-esque, tiny bash-pipey monster took form. It now resides, chained to an alias, hssx1 in my .bash_aliases file

1
2
3
alias hssx='cd /path/to/my/hugo/folder && \
xdotool windowsize $(xdotool getactivewindow) 100% 100% && \
tmux new-session \; split-window -h \; select-pane -l \; split-window -v \; select-pane -U \; send-keys "hugo serve" C-m \; select-pane -R'
  1. The first line switches to my hugo folder
  2. The second calls xdotool and maximises the terminal window
  3. And the last line is a series of instructions to the tmux command. I’ve split it below for readability.
tmux new-session \; #Tmux start a new session
split-window -h \; # Split the window into two vertical panes
select-pane -l \; # Switch to the left pane
split-window -v \; # Split that into two horizontal panes
select-pane -U \; # Select the upper pane
send-keys "hugo serve" C-m \; # Type in `hugo serve` followed by Enter
select-pane -R # Select the right pane

And boom!

bash terminal showing a tmux window split into three panes

Click pic for a larger version


Feedback on this post?
Mail me at feedback at this domain or [continue the discourse here][3].

P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.


  1. hugo start session and x just because all my aliases have ended with x for years and years ↩︎