Now that Windows Terminal has its right-click context menu and more useful features relating to same, I find myself wanting to use it. This isn’t a problem in most of my shells, of course, except when using the Windows Subsystem for Linux, where I use tmux, and since it has been my perennial habit since long before there was WSL, also tmux mouse mode.
On the one hand, this is simple. While tmux (when mouse mode is enabled) captures all mouse activity, holding down SHIFT when using the mouse in Windows Terminal overrides passing mouse activity through to the underlying shell, so this alone is enough to let you use the Terminal-native mouse features.
Is this not good enough?
Well, when I’m doing a lot of back-and-forthing between Terminal windows and other windows, no, not really, having to remember to hold down SHIFT is a little annoying. Fortunately, the workaround is equally in size to the problem, and fits neatly in two lines of .tmux.conf.
# -- mouse support --------------------------------------------------------- | |
# Enable mouse control (clickable windows, panes, resizable panes) | |
set -g mouse on | |
bind m set mouse | |
# -- status line ----------------------------------------------------------- | |
set -g status-interval 10 | |
set-option -g status-fg brightyellow | |
set-option -g status-bg blue | |
set -g status-left '#{prefix_highlight}[#S] #{?mouse,TMUX,TERM} > ' | |
set -g status-left-length 32 |
Adding bind m set mouse to this file offers a single hotkey to toggle tmux mouse support on and off (and thus Terminal mouse support without SHIFT off and on); and, for my convenience, the latter part of the status-left setting adds an indicator to the tmux status line displaying the current status of this setting:
(Told you it was a small thing.)