# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ Uncomment the colors you like ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

# T0B = inactive pane background, border background
# TAB = active pane background
# TB* = pane borders
# T1* = inactive tab, hostname and clock,
#       inactive window number
# T2* = active tab, bell flag, active window number
# TS* = sync-attr colors
# TZ* = zoom-attr colors

# shared flags
TSF=colour201
TSB=colour095
TZF=colour047
TZB=colour028

# ━━━ catppuccin macchiato (pick one T2B) ━━━
TBB="#181926" # crust (border background)
TBF="#6e738d" # overlay0 (border foreground)
T0B="#24273a" # base
TAB="#363a4f" # surface0
T1F="#b8c0e0" # subtext1
T1B="#363a4f" # surface0
T2F="#363a4f" # surface0
#T2B="#f4dbd6" # rosewater
#T2B="#f5bde6" # pink
#T2B="#c6a0f6" # mauve
#T2B="#8aadf4" # blue
T2B="#ed8796" # red

# ━━━ catppuccin mocha ━━━
#TBB="#11111b" # crust (border background)
#TBF="#6c7086" # overlay0 (border foreground)
#T0B="#1e1e2e" # base
#TAB="#313244" # surface0
#T1F="#bac2de" # subtext1
#T1B="#313244" # surface0
#T2F="#313244" # surface0
#T2B="#f5e0dc" # rosewater
#T2B="#f5c2e7" # pink
#T2B="#cba6f7" # mauve
#T2B="#89b4fa" # blue



# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ End of color definitionss ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛



# ┌──────────────┐
# │ Key bindings │
# └──────────────┘

# prefix = Ctrl+A, Ctrl+A a to send it literally (like screen)
unbind C-b
set-option -g prefix C-a
bind a send-prefix

# reload config
bind r source-file "/etc/tmux.conf" \; display-message "config reloaded"

# S to type into all panes at once
unbind-key s
bind-key s set-window-option synchronize-panes

# prefix then / for vertical split, - for horizontal
unbind-key %
unbind-key '"'
unbind-key /
unbind-key -

# split in the same directory as the source pane
bind-key / split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"

# ┌─────────────┐
# │ Misc config │
# └─────────────┘

# mouse (scrolling, selection)
set-option -g mouse on

# I got room!
set-option -g history-limit 100000

# rename windows using escape sequences
set-window-option -g automatic-rename off
set-option -g allow-rename on

# so pagers don't blank the screen
#set-option -g alternate-screen off

# True color
set-option -ga terminal-overrides ",xterm*:Tc"

# waiting for escape sequences introduces delays in vim/kak/hx
set-option -s escape-time 0

# ╭───────────╮
# │ Statusbar │
# ╰───────────╯

# enable the statusbar and set some stuff
set-option -g status on
set-option -g status-justify "left"
set-option -g status-left-style none
set-option -g status-left-length "80"
set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""

# statusbar background color
set-option -g status-style bg=$T0B

# shortened hostname on the left
set-option -g status-left "#[bg=$T1F,fg=$T1B] #{=4:host_short} #[bg=$T0B] "

# window list in the middle
set-window-option -g window-status-current-format "#[bg=$T2B,fg=$T2F] #I #{p-10:#{s/ *\\(.*//:#{=10:window_name}}} #{?window_zoomed_flag,#[bg=$TZB#,fg=$TZF]Z,}#{?pane_synchronized,#[bg=$TSB#,fg=$TSF]S,}#[bg=$T0B] "
set-window-option -g window-status-format "#[bg=$T1B,fg=$T1F]#{?window_bell_flag,#[bg=$T2B#,noreverse] , }#[bg=$T1B,fg=$T1F]#I #{p-10:#{s/ *\\(.*//:#{=10:window_name}}} #{?window_zoomed_flag,#[bg=$TZB#,fg=$TZF]Z,}#{?pane_synchronized,#[bg=$TSB#,fg=$TSF]S,}#[bg=$T0B] "

# clock on the right
set-option -g status-right " #[bg=$T1F,fg=$T1B] %H:%M "

# ╭────────────╮
# │ Misc stuff │
# ╰────────────╯

# pane borders
set-option -g pane-border-lines heavy
set-option -g pane-border-indicators arrows
set-option -g pane-active-border-style fg=$T1F
set-option -g pane-border-style fg=$T1B

# pane backgrounds
set -g window-active-style bg=$T0B
set -g window-style bg=$TAB

# tmux messages
set-option -g message-style bg=$T2B,fg=$T2F

# pane numbers visible with ^A q
set-option -g display-panes-active-colour $T1F
set-option -g display-panes-colour $T2F
