Skip to content

Add support for tmux control mode (#3656)#18928

Open
joexue wants to merge 14 commits intomicrosoft:mainfrom
joexue:tmux_cc_pr
Open

Add support for tmux control mode (#3656)#18928
joexue wants to merge 14 commits intomicrosoft:mainfrom
joexue:tmux_cc_pr

Conversation

@joexue
Copy link

@joexue joexue commented May 20, 2025

Summary of the Pull Request

Let WT supports tmux control mode

References and Relevant Issues

#3656

Detailed Description of the Pull Request / Additional comments

Screenshot 2025-05-13 232209

Support:

  • Create/attach tmux session

  • Split pane vertical/horizontal

  • Window/panes size change

  • Remove pane/tab if remote pane exit or window exit

Improvements may do:

  • Merge the tmux menus/button with existing menu/button
  • Add the keyboard accelerators for tmux menus
  • Unicode support(the VTParser just pass part of characters in DCS mode
  • When attached a session, focus on the same focused tab/pane when detaching(backend is done, need to do some work frontend)
  • Test code

Tested by using tmux 3.4:
ssh to a machine has tmux or use wsl, then run
"tmux -CC" or "tmux -CC a"

Validation Steps Performed

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-Interop Communication between processes Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels May 20, 2025
@joexue

This comment was marked as outdated.

@github-actions

This comment has been minimized.

@joexue

This comment was marked as outdated.

@joexue

This comment was marked as outdated.

@joexue
Copy link
Author

joexue commented May 20, 2025

@microsoft-github-policy-service agree

@DHowett
Copy link
Member

DHowett commented May 20, 2025

whoa

@iDarshan
Copy link

This is a long-awaited feature! Thanks @joexue!

@BinaryShrub
Copy link

gif

@DHowett
Copy link
Member

DHowett commented May 23, 2025

FYI: I am working with reduced staffing at the moment, so reviews may be slow to come. I apologize for that.

@iDarshan
Copy link

iDarshan commented Jun 3, 2025

Is there a nightly build with this PR to test?

@carlos-zamora
Copy link
Member

Is there a nightly build with this PR to test?

Your best bet is to build this locally. Once it merges, it will be available on the Canary channel though.

@iDarshan
Copy link

iDarshan commented Jun 6, 2025

Is there a nightly build with this PR to test?

Your best bet is to build this locally. Once it merges, it will be available on the Canary channel though.

I tried to find the build guide, but couldn't find one. Do you have the link handy?

@joexue
Copy link
Author

joexue commented Jun 6, 2025

Is there a nightly build with this PR to test?

Your best bet is to build this locally. Once it merges, it will be available on the Canary channel though.

I tried to find the build guide, but couldn't find one. Do you have the link handy?

README.md ->Developer Guidance @iDarshan

@carlos-zamora
Copy link
Member

Hi @joexue! Thanks for doing this! I published a build for the team to test internally and we've got a few notes we want to share with you 😊

  • Notes/Reactions:
    • Settings menu item is gone from the dropdown
    • It makes your existing window a special "tmux only" window; it disables the menu, but it doesn't disable the key bindings, so you can still split in non-tmux panes
    • Scrollbars are gone? I guess scrolling is server side
  • Requested changes:
    • [Bug] can't type in an older pane after splitting panes
    • tmux tabs should not be draggable into a new window
    • Add a setting to Profile > "Terminal Emulation" page that disables this (it should be disabled by default)
    • Bug: Closing a tab/pane will not kill the instance on the server side
    • Add a feature flag to features.xml (Guidance)
    • [Architectural notes] We should see if we can't just model a tmux pane as a connection so we don't need to pump output into the terminal from the App layer

Overall, this is a really exciting feature and we're excited to see it land! Let us know if you need any guidance or additional comments on any of the thoughts above. 😊

CC @DHowett @lhecker @zadjii-msft

@joexue
Copy link
Author

joexue commented Jun 12, 2025

Hi @joexue! Thanks for doing this! I published a build for the team to test internally and we've got a few notes we want to share with you 😊

  • Notes/Reactions:

    • Settings menu item is gone from the dropdown
    • It makes your existing window a special "tmux only" window; it disables the menu, but it doesn't disable the key bindings, so you can still split in non-tmux panes
    • Scrollbars are gone? I guess scrolling is server side

Scrollbars are gone is by design, I put the comment in the code, since we want to make local panes size match remote(tmux) panes size, but each split, tmux just lost 1 character to use it as separator, if we have side scrollbars, we cannot make two side's size match. To meet this, the padding size is changed too.

As the menu, it is because I tried to touch as less code as I can to do the job. So give the tmux a separate UI system. I described in the PR, this could be improved and should integrated into the present UI/menu system.
But, I think we can skip this ugly stage, directly change the code to make the tmux control mode work with present UI/menu system. I will address this, those +button/flyout splitting menus specifically for tmux will be gone.

  • Requested changes:

    • [Bug] can't type in an older pane after splitting panes

I did not see this bug, to help me to reproduce it here, could you describe your env? how do you connect to tmux server? what is the tmux version?

  • tmux tabs should not be draggable into a new window

Sure, let me fix it.

  • Add a setting to Profile > "Terminal Emulation" page that disables this (it should be disabled by default)

Sure, let me look it.

  • Bug: Closing a tab/pane will not kill the instance on the server side

This is by design, remote pane should close by quit it's app. but this is arguable, if we think close local pane should close remote pane too, it is easy and feasible.

  • Add a feature flag to features.xml (Guidance)

Sure. Fair enough.

  • [Architectural notes] We should see if we can't just model a tmux pane as a connection so we don't need to pump output into the terminal from the App layer

Please provide the idea, I can try to implement it.

Overall, this is a really exciting feature and we're excited to see it land! Let us know if you need any guidance or additional comments on any of the thoughts above. 😊

CC @DHowett @lhecker @zadjii-msft

Thanks!

Since this PR is a bit big, another option is we split it into two or three parts to make it easy to review and integrate. Such as
part 1: infra libs(parser, TermControl, Terminal, ControlCore)
part 2: TmuxControl
part 3: integrating and UI/Menu

What do you think, split it or just keep as it is?

@joexue
Copy link
Author

joexue commented Jun 17, 2025

@carlos-zamora @DHowett @lhecker @zadjii-msft
All comments are addressed, please try again.

Thanks

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@joexue joexue force-pushed the tmux_cc_pr branch 2 times, most recently from 54c2bac to 4817698 Compare June 20, 2025 01:35
@DHowett
Copy link
Member

DHowett commented Dec 18, 2025

@joexue Yep, don't worry about the Needs-Author-Feedback. Even if the PR gets automatically closed.

As long as you keep your fork up, and your branch open, we prefer to work on your PR like this.

That way, you get credit for doing the bulk of the work -- and we can thank you appropriately when it ships. We would literally not have started on this without you. :)

@DHowett
Copy link
Member

DHowett commented Dec 18, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@lhecker
Copy link
Member

lhecker commented Jan 6, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@lhecker
Copy link
Member

lhecker commented Jan 6, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@lhecker
Copy link
Member

lhecker commented Jan 13, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@iDarshan
Copy link

I tried to test this and seems like its not working

root@fst:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble
root@fst:~# tmux ls
0: 1 windows (created Sat Jan 31 02:31:00 2026)
root@fst:~#
root@fst:~# tmux -CC attach
root@fst:~#
root@fst:~# tmux -V
tmux 3.4
root@fst:~#

Anything special need to be done to try this?

@DHowett
Copy link
Member

DHowett commented Jan 31, 2026

Anything special need to be done to try this?

You probably need to turn it on in Settings.

@iDarshan
Copy link

Anything special need to be done to try this?

You probably need to turn it on in Settings.

Which settings? in Terminal or System settings? Do you have path to setting?

@DHowett
Copy link
Member

DHowett commented Jan 31, 2026

Which version of Terminal are you using? Did you compile it yourself? Since this pull request is still open and has not been accepted, you would need to have compiled it yourself.

@iDarshan
Copy link

Which version of Terminal are you using? Did you compile it yourself? Since this pull request is still open and has not been accepted, you would need to have compiled it yourself.

Compiled myself. It took hell of a time to figure out compilation steps. it always fails due to vcpkg. Readme needs to include steps around vcpkg failure.

@DHowett
Copy link
Member

DHowett commented Jan 31, 2026

Oh dang, that's a new failure state we haven't heard of. If you remember what you had to do, would you mind sharing? It's supposed to use the vcpkg install that comes with VS, but if that's broken it will try a couple other things.

I think this PR puts the control mode toggle into Terminal's in-app settings, profile (or defaults), advanced.

@iDarshan
Copy link

iDarshan commented Feb 1, 2026

Enable this setting to allow Tmux Control mode:
Settings->Defaults->Additional Settings->Terminal Emulation->Allow Tmux Control

@iDarshan
Copy link

iDarshan commented Feb 1, 2026

I have tested this briefly and here are the basic bugs:

  • Cannot resize the panes
  • Alt + (+ button) click always splits the current pane vertically, no way to split pane horizontally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-Interop Communication between processes Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for tmux Control Mode

7 participants