Faça sua barra de status TMux responsiva

Recentemente, criei um script simples que cria um tema semelhante ao Powerline para TMux. Vejo:

#!/bin/sh

LSEP
=
LSEPE
=
RSEP
=
RSEPE
=

CLOCK
=⌚
CALENDAR
=☼
MUSIC
=♫

WIDTH
=${1}

SMALL
=80
MEDIUM
=140

if [ "$WIDTH" -gt "$MEDIUM" ]; then
MPD
="#[fg=colour252,bg=default,nobold,noitalics,nounderscore]$RSEP#[fg=colour16,bg=colour252,bold,noitalics,nounderscore] $MUSIC $(mpc current)"
date_colour
='colour252'
fi

if [ "$WIDTH" -ge "$SMALL" ]; then
UNAME
="#[fg=colour252,bg=colour236,nobold,noitalics,nounderscore]$RSEP#[fg=colour16,bg=colour252,bold,noitalics,nounderscore] $(uname -n)"
fi
DATE
="#[fg=colour236,bg=${date_colour:-default},nobold,noitalics,nounderscore]$RSEP#[fg=colour247,bg=colour236,nobold,noitalics,nounderscore] $CALENDAR $(date +'%D')"
TIME
="#[fg=colour241,bg=colour236,nobold,noitalics,nounderscore]$RSEPE#[fg=colour252,bg=colour236,bold,noitalics,nounderscore] $CLOCK $(date +'%H:%M')"

echo
"$MPD $DATE $TIME $UNAME " | sed 's/ *$/ /g'

Uso:

set -g status-fg colour231
set -g status-bg colour234
set -g status-left-length 20
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]'
set -g status-right '#(eval tmux-airline `tmux display -p "#{client_width}"`)'
set -g status-right-length 150

set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[default]#W "
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I  #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"

set-window-option -g window-status-fg colour249
set-window-option -g window-status-activity-attr none
set-window-option -g window-status-bell-attr none
set-window-option -g window-status-activity-fg yellow
set-window-option -g window-status-bell-fg red

Lembre-se de definir status-intervalcomo 1.

Amostras

Janela pequena (até 80 colunas):
Cenário

Médio (até 160 colunas):
Cenário

Grande (mais de 160 colunas):
Cenário

Síntese: https://gist.github.com/8127857