# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

# Enable vi copy mode
setw -g mode-keys vi

# remap prefix from 'C-b' to 'C-Space'
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
unbind C-`

# split panes using | and
bind h split-window -v
bind v split-window -h
unbind '"'
unbind %

# resizing panes with prefix+vimkeys
bind-key -r -T prefix       C-k              resize-pane -U 5
bind-key -r -T prefix       C-j              resize-pane -D 5
bind-key -r -T prefix       C-h              resize-pane -L 5
bind-key -r -T prefix       C-l              resize-pane -R 5

# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.config//tmux/tmux.conf

# switch panes using Alt-vimkeys without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D

# Enable mouse control (clickable windows, panes, resizable panes)
set -g mouse on

# don't rename windows automatically
set-option -g allow-rename off

# DESIGN TWEAKS

# don't do anything when a 'bell' rings
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none

# colors
set-option -sg default-terminal "screen-256color"

# copy mode
setw -g mode-style 'fg=black bg=red bold'

# panes
set -g pane-border-style 'fg=white'
set -g pane-active-border-style 'fg=blue'

# statusbar
set -g status-position top
set -g status-justify left
set -g status-style 'fg=red'

set -g status-left ''
set -g status-left-length 10

set -g status-right-style 'fg=white'
set -g status-right '#[fg=black]#{online_status}#{@sep} #[bg=colour230]Batt: #{battery_percentage}#{@sep} #[fg=white bg=blue]%d.%m.%Y %H:%M'
set -g status-right-length 50

#setw -g window-status-current-style 'fg=white bg=blue'
setw -g window-status-current-format ' #I #W #F '

setw -g window-status-style 'fg=blue bg=white'
setw -g window-status-format ' #I #[fg=blue]#W #[fg=yellow]#F '

setw -g window-status-bell-style 'fg=yellow bg=red bold'

# messages
set -g message-style 'fg=yellow bg=red bold'

# clock mode
setw -g clock-mode-colour yellow

run '/usr/share/tmux-plugin-manager/tpm'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-online-status'

set -g @online_icon "#[bg=green]online"
set -g @offline_icon "#[bg=red]offline"

set -g @sep "#[bg=default] "
