DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Tmux Active Pane Focus

In this post I would like to show how to set pane colors for active and inactive panes of tmux. So you distinguish your active panel and focus easily as shown below:

Tmux Focus Active Inactive Pane

The picture above shows how the inactive panes are slightly greyed, and that the border of the active panes is blue.

Active-inactive pane colors config

Below color settings are for those who prefer a dark background. If you use light background then you need to change the colors accordingly.

Or if you have any other preferences please adress this x-term 256 color chart chart can be found on this Wikimedia page.

The below block of code sets the colors of the active-inactive panes, and the borders of the panes if you like. The ability to distinguish the active-inactive pane backgrounds is a feature of tmux 2.1. So please be sure you are using tmux version >= 2.1. To check this use:

$ tmux -V
Enter fullscreen mode Exit fullscreen mode

If OK then add the following to your .tmux.conf:

#-------------------------------------------------------#
# Pane colours
#-------------------------------------------------------#
# set active-inactive window styles
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=default,bg=colour234'

# Pane border
set -g pane-border-bg default
set -g pane-border-fg colour238

# Active pane border
set -g pane-active-border-bg default
set -g pane-active-border-fg blue
#-------------------------------------------------------#
#
#-------------------------------------------------------#
Enter fullscreen mode Exit fullscreen mode

And then source your .tmux.conf file.

$ tmux source-file ~/.tmux.conf
Enter fullscreen mode Exit fullscreen mode

If you like keybindings for common-used commands like me add this keybinding to your .tmux.conf file to source your tmux config:

# reload tmux config
bind R source-file ~/.tmux.conf \; display-message "Tmux config file reloaded."
Enter fullscreen mode Exit fullscreen mode

All done.

In order to apply active-inactive window style to Vim panes too check this: post

Top comments (0)