ghostty icon indicating copy to clipboard operation
ghostty copied to clipboard

Feature: Support for tmux's Control Mode

Open yankcrime opened this issue 1 year ago • 9 comments

tmux has a feature called Control Mode, which allows a client i.e a terminal emulator such as Ghostty to manage tmux panes. This has the benefit of enabling native integration with the terminal emulator and by extension the host OS system, making it easier to manage buffers without having to jump through hoops imposed when using tmux directly.

yankcrime avatar Jul 10 '24 08:07 yankcrime

Ah yes, I've been meaning to do this. I've started working on at least the tmux control mode parser. I believe I'll bring that in via a PR first before integrating more parts of Ghostty into it.

Here is a list of TODOs that I plan on doing independently so we don't have one massive PR. The checklist today doesn't necessarily map 1:1 to a PR but is the set of somewhat separable work to do:

  • [x] Control Mode DCS Parser (#1946)
  • [ ] Termio needs to support not executing a subprocess
    • [x] Partial: #1948
  • [ ] Apprt API changes to note non-subprocess-based surfaces
  • [ ] Termio hooks to trigger the proper events on tmux notifications
  • [ ] Parser for tmux command output (i.e. list-windows) and the command to send for it

mitchellh avatar Jul 12 '24 03:07 mitchellh

Nice!! I think it'll also need #189 to really make sense.

yankcrime avatar Jul 12 '24 08:07 yankcrime

I got the control mode notification parser in in #1946. This is just one of many steps (see my first comment).

mitchellh avatar Jul 12 '24 21:07 mitchellh

Is this the same as the tmux integration in iTerm2 (enabled by adding -CC to the tmux command)?

If so, consider this a gigantic +1 (+1M). I'm so dependent on that feature that I'll probably continue to use iTerm2 until Ghostty or another terminal emulator supports it.

dtenenba avatar Dec 27 '24 18:12 dtenenba

@dtenenba Yes, an equivalent feature implemented in Ghostty is the intended outcome from this issue.

yankcrime avatar Dec 27 '24 23:12 yankcrime

Sorry is this also the same as 'programmatic control' so that Vim-Tmux-Navigator works simultaneous on Nvim and a tux terminal pane?

jasonshanks avatar Jan 10 '25 13:01 jasonshanks

Has this been implemented yet?

Euphrasiologist avatar Apr 08 '25 14:04 Euphrasiologist

See if you can guess: A screenshot of the issue titlebar showing a green “Open” on the left.

And to quote Mitchell from a couple days ago on the Ghostty Discord server:

The parsing is in good shape, well unit tested, and easy to add new commands to it (I didn't add all of them because there are a lot). The hold up at this point is the ability to create new apprt things (windows/splits/tabs) that aren't attached to a normal exec-based termio. Which is pretty fundamentally hard. But something I want to tackle

00-kat avatar Apr 09 '25 01:04 00-kat

Sorry if this is irrelevant, but for those are not aware, Wezterm recently merged Tmux Control mode feature. If you subscribed to this issues because Wezterm wasn't supported it back then, give it a try now. It is currently in nightly version only I think. https://github.com/wezterm/wezterm/pull/6602

lkhphuc avatar Apr 09 '25 06:04 lkhphuc