set -g default-command "/bin/bash"

# Support mouse scrolling, system clipboard, etc.
set -g mouse on
bind-key -T copy-mode-vi WheelUpPane send -N2 -X scroll-up
bind-key -T copy-mode-vi WheelDownPane send -N2 -X scroll-down

set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
set-option -g escape-time 10
set -g focus-events on
bind-key r source-file "~/.tmux.conf"

# After scrolling and selecting text, don't leave copy mode
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection

# Necessary for the styling!
setw -g pane-base-index 1
set -g base-index 1

# Styling
# set -g default-terminal "xterm-256color"
set -g status-style bg=#3c3836,fg=#a89984
set -g status-left "#[bg=#fb4934,fg=#3c3836]  #{session_name} #[bg=#fe8019,fg=#fb4943]#[bg=#504945,fg=#fe8019]"
set -g window-status-format "#[bg=#504945] #{window_index}-#{window_name} #{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836 fg=#504945],}"
set -g window-status-current-format "#[bg=#a89984,fg=#504945]#[fg=#282828] #{window_index}-#{window_name} #[bg=#504945,fg=#a89984]#{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836],}"
set -g window-status-separator ""
set -g status-right "#(2>/dev/null pomo && 2>/dev/null pomo | grep -Fq -- '-' && 2>/dev/null 1>&2 paplay '/home/tosuman/music/Gong Sound Effect.mp3') #(pwd) #[fg=#504945]#[bg=#504945,fg=#a89984] #(whoami)  #[bg=#a89984,fg=#282828] #{host_short} 󰍹  #[bg=#a89984,fg=#fe8019]#[bg=#fe8019,fg=#fb4934]#[bg=#fb4934,fg=#3c3836] #(date +%H:%M) "
set -g status-right-length 500
set -g status-interval 1
set -g pane-base-index 1
set -g pane-border-format "#{?pane_active,#[fg=#3c3836 bg=#fb4934] #{pane_index}-#{pane_current_command} #[fg=#fb4934 bg=default], #{pane_index}-#{pane_current_command} }"
set -g pane-border-status 'top'
set -g pane-border-style fg=#fb4934
set -g pane-active-border-style fg=#fb4934
# set-option -ga terminal-overrides ",xterm*:Tc"
set-option -g history-limit 100000

# CTRL-Space instead of CTRL-B as prefix
unbind C-b
set-option -g prefix C-Space
bind-key -n M-a send-prefix

bind-key -T prefix h select-pane -L
bind-key -T prefix j select-pane -D
bind-key -T prefix k select-pane -U
bind-key -T prefix l select-pane -R

bind-key -r -T prefix C-h resize-pane -L 2
bind-key -r -T prefix C-j resize-pane -D 2
bind-key -r -T prefix C-k resize-pane -U 2
bind-key -r -T prefix C-l resize-pane -R 2

bind-key -T prefix C-u popup -E '~/.local/bin/tmux_urls'

set-option -g set-titles on

# run-shell ~/repos/tmux-copycat/copycat.tmux
