
# Use ` as a prefix
set -g prefix `
unbind-key C-b

# Allow `` to enter a backtick.
bind-key ` send-prefix

# Inherit some environment stuffs.
set-option -g update-environment " \
	XDG_SESSION_TYPE XDG_CURRENT_DESKTOP XDG_RUNTIME_DIR XDG_SESSION_CLASS XDG_SESSION_DESKTOP \
	SESSION_MANAGER DESKTOP_SESSION DBUS_SESSION_BUS_ADDRESS GDMSESSION GDM_LANG GDM_LANG INVOCATION_ID \
	JOURNAL_STREAM DISPLAY WAYLAND_DISPLAY XAUTHORITY SWAYSOCK SS_CLIENT SSH_CONNECTION DISPLAY SSH_ASKPASS \
        SSH_AUTH_SOCK SSH_AGENT_PID XAUTHORITY "

# Order our panes to start at one, matching our keyboard.
set -g base-index 1
set-window-option -g pane-base-index 1

# Have zero select the tenth panel.
bind-key 0 select-window -t :=10

# Setup Window Titles [Ara]
set-window-option -g automatic-rename on
set-option -g set-titles on
setw -g monitor-activity on
set -g visual-activity on

# Configure mouse control.
set -g mouse on
 
# Emulation of vi's normal mode [Ara].
setw -g mode-keys vi
unbind [
unbind ]
bind Escape copy-mode #<prefix> Esc now enters copy mode
unbind p
bind -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi Escape send -X cancel
bind-key -T copy-mode-vi 'V' send -X rectangle-toggle

# Platform-Specific Config [Ara]
if-shell "uname | grep -q Darwin" "source-file ~/dotfiles/tmux/macos.conf" "source-file ~/dotfiles/tmux/linux.conf"

# Configuration reloading.
unbind r
bind r source-file ~/.config/tmux/tmux.conf

# Always keep our history length.
set-option -g history-limit 1000000

#### COLORS (Solarized dark)

# default statusbar colors
set-option -g status-style fg=yellow,bg=black #yellow and base02

# default window title colors
set-window-option -g window-status-style fg=brightblue,bg=default #base0 and default
#set-window-option -g window-status-style dim

# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default
#set-window-option -g window-status-current-style bright

# pane border
set-option -g pane-border-style fg=black #base02
set-option -g pane-active-border-style fg=brightgreen #base01

# message text
set-option -g message-style fg=brightred,bg=black #orange and base01

# pane number display
set-option -g display-panes-active-colour blue #blue
set-option -g display-panes-colour brightred #orange

# clock
set-window-option -g clock-mode-colour green #green

# bell
set-window-option -g window-status-bell-style fg=black,bg=red #base02, red

# tmux-wormhole: save wormhole files with tmux-wormhole to tmp
set -g @wormhole-save-folder '/tmp/'

# tmux-wormhole: don't open wormhole files by default
set -g @wormhole-no-default-open false

# always install plugins
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

# plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-cowboy'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'gcla/tmux-wormhole'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'Alkindi42/tmux-bitwarden'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'tmux-plugins/tmux-sessionist'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
