Tmux configuration and scripting

Posted on April 12, 2020

Configuration

# My very simple tmux configuration file in `~/.tmux.conf`
set-option -g status-position top
set -g status-bg blue
set -g status-left '' # removing the session number
setw -g window-status-current-format '#[fg=colour1,bg=colour11]#I:#W'

Scripting (example)

karblog=$HOME/repos/blog-karchnu/
dnsblog=$HOME/work/dnsmanager-website/

set -e

# This is the first window, with a default name
tmux rename-window "karchnu's blog"
tmux split-pane -h
tmux select-pane -t 0
tmux send-keys "cd '$karblog' && ./site watch" 'C-m'
tmux select-pane -t 1
tmux send-keys "cd '$karblog'" 'C-m'

tmux new-window -n "dnsmanager website"
tmux split-pane -h
tmux select-pane -t 0
tmux send-keys "cd '$dnsblog' && start-zola.sh" 'C-m'
tmux select-pane -t 1
tmux send-keys "cd '$dnsblog'" 'C-m'

Reloading the configuration

tmux source-file ~/.tmux.conf

Or through the tmux build-in cli: ^: source-file ~/.tmux.conf

Tags: tmux