tmux: enable mouse only when shift pressed

I’ve tried to set -g mouse on, and it works pretty well, but standard mouse behaviour (select, copy & paste) is disabled. But, it enables if I press “Shift” button, and while I hold it, I can select, copy & paste text from/to terminal. Can I inverse this behaviour? I want to use mouse inside tmux (for example to select panes or resize them) only with shift pressed.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

short: no

long: The behavior is terminal-dependent…

The terminals that you would use tmux on hard-code their behavior to match the behavior of xterm.

While xterm provides a way to assign different actions to different mouse/button/modifier combinations (see Default Key Bindings), it makes assumptions about the use of the shift key as well. The translations resource is flexible in some respects, but does not (aside from the keymap feature introduced in X11R4) provide for changing the translations back/forth as one starts and stops mouse-mode.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply