Click to scroll to my list of supported apps
Once you start using tmux with your terminals, you will literally uproot your progress exponentially. It is an absolutely game-changing application of productivity that allows you to “multiplex” shells. Hence why they call it called a terminal multiplexer. It gives you the ability to have multiple tabs (known as windows), and those tabs can be split horizontally and vertically into multiple panes, run commands across multiple panes (if each pane is connected to a different server, you can interactively control multiple devices at the same time). Of course, your PC can come (or you can download) terminal apps that support these features. For example, MobaXterm & Terminator supports multiple panes and tabs, however, they are not constantly running in the background. So if you close out the terminal or shell you lose all of your progress. With tmux all of your progress is saved, so if you ssh into a server, open up tmux, open up many tabs throughout your productive day, and do work. Then your host PC gets disconnected or it’s the end of your day, you can just re-login and continue your work with tmux. If you used those features on any other app you would need to restart everything. Of course some of those apps can remember your settings, but it is not the same as just resuming your session. No one comes close to tmux, besides screen and byobu (but they are all basically the same technology). There is another aspect to tmux which is unfortunately annoying, but it does not play well with all terminals (or more like terminals dont play well with tmux). For example with iterm all of the features work, but not with cygwin terminal or other terminals. They might be lacking a very important feature which might be complete show stopper: Tmux mouse copy.
For all of these, you have to have tmux installed on a remote server with mouse mode enabled thru the configs. Then on your host computer (Windows, MAC, Ubuntu), you ssh into this server and open up a tmux session with tmux
. Then you can create some panes and output (for example: find
/) and try to select the output with your mouse. You will notice sometimes, depending on your terminal, the output goes into your clipboard and sometimes it does not.
Sidenote: I mentioned having tmux on a remote server because it adds an extra layer of difficulty to achieve in getting the clipboard to work properly. Of course, using tmux on your main workstation works and you can get tabs, however, if your workstation loses connection or power, all of the work you might have in the panes (that are connected remotely) will be disconnect. I think we all can agree that a simple clipboard should just work out of the box & it does with some terminals but not all.
If you spend a lot of time behind a terminal, having a working terminal-to-clipboard capability is a must for your productivity. If that feature does not work, then that terminal app should not be used. It is as simple as that.
There is a workaround if it does not work, you can hold a key (depending on the terminal), Alt, Shift or Fn and start dragging with the mouse. However, this is raw copy mode and does not understand panes. So it will copy the blank space that surrounds panes + this does not work with scrolling. To workaround that you can use tmux’s zoom ability to zoom into your pane, so that it takes up the entirety of the terminal’s real-estate and use the raw copy. It can select what you see on there, but you still cannot scroll thru up to grab previous content. What we need is a terminal with an understanding of tmux’s copy selection.
The best way to understand this topic is to be a tmux user that connects to remote servers often & works with the two. However, one can get an idea of the 2 copy modes in this post by Sean Hammond. You can see the two different copy methods. Tmuxes copy mode that understands panes and scrolling is the yellow selection, and the copy that is raw and does not understand tmux panes is grey selection. I feel like every terminal app that supports tmux was probably engineered in part by users that are heavy users of this feature.
Of course, tmux offers a copy mode, however, that tech that is cumbersome laborious and not very useful to the fast user that simply wants to use the mouse to select content, have it copied into the clipboard, and then paste it into a shell
What do I mean by playing well with tmux?
- ssh into remote server, open tmux, select text with tmux & copy
- the content you copy should go to your workstations clipboard (not the server you remoted into)
- you can also still use the raw copy mode by holding a key, not as useful but might come in handy
What happens when it does not play well with tmux?
- When you copy with tmux, it does not go to your clipboard, it might go to that server’s clipboard but thats about it. You need it to go to your hosts clipboard. This is why for my test case, I added the necessity of having to login to a remote server via ssh.
- You can also scroll with the wheel and select text while you are scrolling for the purpose of copying to your clipboard.
Most of these mentioned terminal apps play well with tmux but to an extent; they do not feature all of the final features that would make it my go-to tool. For example, every app I mention below works with mouse mode to an extent. You can click around and switch tabs and panes. You can make panes smaller and bigger by dragging the edges. However, copy mode is a hit and miss in this industry for now.
Configuration: By the way tmux does not come with mouse mode enabled by default you have to enable it with tmux configs. Here are my favorite tmux configs with mouse mode enabled. I have the default ones here so if you are used to control-b then you have that and if you want to get used to more screen like bindings with control-a or control-q I have those too. Link: http://infotinks.com/tmux-look-screen-dtach-byobu-tmux-wins-indepth-tmux/
My List Of Supported Tmux Copy Terminals
Windows
- Putty -> Does not work with tmux’s copy
- Cygwin Terminal -> Does not work with tmux’s copy
- Terminal (WSL) -> Works 🙂
- MobaXterm -> Does not work with tmux’s copy
- I pay money for this software too and I have reached out to their team to include it. At first, it seemed like they will not even think about it, but after my attempt at persuasion, they might start working on it. If I don’t get it by next year or at least see that its put on a roadmap I will cancel my service. Not trying to be negative, but if I don’t use an app, I don’t want to pay for it.
- One can use a workaround of holding Shift while selecting. This bypasses the tmux copy and uses the terminal’s copy. It will immediately copy the selection to the clipboard. You will notice it selects the entire row of the terminal disregarding any panes or tmux items. You can even copy beyond the panes and the tab/window header at the bottom.
- Due to this behavior, this workaround will not work with vertical splits. For that, I suggest zooming into the pane (Prefix key then Z key) to get rid of the splits, then select your content while holding the Shift key, and then zoom back out (Prefix then Z).
- Finally, this workaround does not work well if you intend to select multiple pages of content. For that I suggest zooming into the pane (Prefix key then Z), then minimizing the text of MobaXterm (Hold the Control key and scroll the mouse wheel down), then selecting while holding the Shift key, then returning the text size back to normal in MobaXterm (Hold Control key and scroll the mouse wheel up), then zoom back out (Prefix key then Z key)
MAC
- Terminal -> Does not work with tmux’s copy
- iterm2 -> Works 🙂
Ubuntu
- Terminal -> Does not work with tmux’s copy
- Terminator -> Does not work with tmux’s copy
Note: probably need to setup xclip. See this article: https://www.fosslinux.com/80608/how-to-copy-and-paste-with-a-clipboard-in-tmux.htm
Other
- If you know of any other terminal apps that play well with tmux and its mouse support. Let me know in the comments and I will add it in.
Extra productivity tools:
- Expand your clipboard ability, I suggest using a clipboard manager. I will list off my favorite ones
- Windows: CLCL (ancient tool but works amazingly)
- MAC: Paste2
- Ubuntu: copyq
- set its menu shortcut to be Control-Shift-~
- set to Always on Top
- set Gnome Settings -> Keyboard -> Customize Shortcuts -> launch “copyq menu” upon Control-Alt-~
- use this article to engrain the shortcuts: https://askubuntu.com/questions/1344833/copyq-global-shortcut-not-working-on-ubuntu-21-04
One thought on “Tmux Mouse Mode Support + Terminal Apps Support Across OS”