How I convenced Tmux developer

Updated: Apr 22, 2023

Tmux Problem

As I already mentioned, MeeTTY uses tmux [2] as a terminal multiplexer to show Presenter's Terminal and Practice Terminal. While developing, I noticed that tmux shown in MeeTTY web page does not show all the contents of the broadcast session, I first thought it may be because of xterm.js [3] not sending current size of its div element properly to pty [4], but, even after syncing xterm.js and pty to correctly set the terminal size [5], still tmux not showing full contents of broadcast session in Presenter's Terminal. All the web terminals which MeeTTY creates through xterm.js and pty will run one tmux client with read-only permission.

A little back story, When tmux server gets new connection from a tmux client, it sets the window size of all the attached clients to the size of the client which has the smallest terminal size, but this commit [6] changed this logic to not consider read-only clients if there is one read-write client available at the time of attaching the new client to the tmux session. This affected MeeTTY, because MeeTTY web page only creates read-only tmux clients, but the tmux client created through [7] which is responsible to provide broadcast session have write permission.

Power of FOSS [13]

With this problem, I approached people in #tmux [9] IRC channel, at first few guys told me that read-only clients should not affect the window size, but I argued that read-only clients affected the size until recently [1] and something got changed this behaviour recently. Then one person with nick nicm [12] replied me to set the read-only clients size through resize-window command in tmux, I then argued that running resize-window after gathering terminal size is bit complicated when terminal size is going to get changed dynamically through pty and told that it will be useful to bring back the old window size logic with a flag, then he said he was hesitant to add another commandline flag. At this point I realized that I was speaking to the Author of tmux Nicholas Marriot [12]. Anyway, I explained my situation with bit more context by explaining what I’m trying with MeeTTY.

After few seconds, nicm decided to bring back the old window size logic, within ten minutes, he pushed one commit [8] and asked me to test his changes, he separated two internal flags read-only and ignore-size from -r option on attach-session command in tmux and introduced a new option -f to explicitly set different internal flags. I was very excited to work with a OpenBSD [10] developer and immediately cloned tmux repository [11] and started building tmux. All in all, It only took just 30 minutes from starting my conversation in #tmux IRC channel to get tmux executable with the desired functionality, I realized that this is the power of FOSS, no second opinions, no waiting for approvals, simple uncomplicated development. I love FOSS.

So this is how I was able to convince Tmux developer to bring back the old default window size logic

To be continued..