Skip to content

Help request: How to set the tab title according to the prompt with Cygwin bash / OSC 2 documentation? #19770

@Binarus

Description

@Binarus

Hello everybody,

I like Windows Terminal very much, and it gets better with every version. I am looking forward to the future development.

However, since ages I have a problem that becomes more pain from day to day, so I have now decided to ask for help. Amongst others, I am using Terminal on Windows together with Cygwin (bash) to perform management tasks on remote servers via SSH. I often have a dozen of Terminal tabs open, each containing a session to a different server.

In this scenario, I would like each Terminal tab title to be the remote server host name, and to change dynamically if I close the respective session with the host and connect to a new host.

The prompt in Cygwin bash is configured so that it contains the host name. For example, if I am connected to host cerberus as user user, the prompt contains user@cerberus.

I think that I have understood how the interaction between Terminal and the shell works. The problem is that I can't find any documentation for this specific use case. The only hint about it is in Terminal's UI itself. The help text for the option Suppress title changes in the profile settings reads: Ignore application requests to change the title (OSC 2).

I am aware that this option must be turned off, but that's not the subject of the question. The key point is the OSC 2. I guess I would be able to alter my prompt to send OSC 2 to Terminal. But obviously, that would lead to nowhere as long as the text (tab title) itself is missing. In other words, I don't know the format of a complete OSC 2 command, and I can't find any information about it.

In contrast, (some of?) the OSC 133 commands are documented:
https://devblogs.microsoft.com/commandline/shell-integration-in-the-windows-terminal/#how-does-this-work

But I was not able to spot something similar for the OSC 2 commands.

Can somebody please help me out there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions