- Published on
Enable or Disable mouse in Tmux
Tmux is one of the most useful tool when it comes to using a linux terminal.
Tmux is a terminal multiplexer, it allows a user to access multiple terminals (or windows), each running a separate program, while providing a single screen to work on. Tmux is useful for running more than one command-line program at the same time, increasing productivity and the way you work.
To enable mouse on Tmux
Enabling mouse gives you options to 'Select' inside the tmux window or pane. Let's look at how to enable copy-paste and select behaviour on tmux.
You can either run a command to activate it temporarily for that session by running the following keyword shortcuts-
Prefix
:set -g mouse on
By default the prefix is Ctrl-B
Ctrl-B
:set -g mouse on
You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf
-
set -g mouse on
After adding the above line to the configuration file, you can reload tmux conf-
tmux source-file ~/.tmux.conf
To disable mouse on Tmux
Disabling mouse gives you options to prevent the 'Select' option inside the tmux window or pane.
You can either run a command to activate it temporarily for that session by running
Prefix
:set -g mouse off
By default the prefix is Ctrl-B
Ctrl-B
:set -g mouse off
You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf
-
set -g mouse off
After adding the above line to the configuration file, you can reload tmux conf-
tmux source-file ~/.tmux.conf
If you are a vi
or vim
enthusiast, then you can enable vi-like copy paste behaviour on tmux as well.
I hope this tutorial for enabling or disabling mouse actions in tmux was useful. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.