Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support runtime variables in the custom user title #1320

Open
6 tasks
zadjii-msft opened this issue Jun 19, 2019 · 7 comments
Open
6 tasks

Support runtime variables in the custom user title #1320

zadjii-msft opened this issue Jun 19, 2019 · 7 comments
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented Jun 19, 2019

The user should be able to embed certain terminal-specific variables in their custom title, that will be updated at runtime.

Something like:

{
    "title":"{numberOfPanes} - Powershell"
}

Would then include the number of panes in the tab title text we display, like so:

5 - Powershell

This is obviously related to #608, but this is certainly out of scope for v1.0. #608 is just setting a simple title string to override the terminal's, this is setting a dynamic title.

@zadjii-msft zadjii-msft added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jun 19, 2019
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 19, 2019
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Jun 19, 2019
@zadjii-msft zadjii-msft added this to Spec Needed ❓ in Specification Tracker via automation Jun 19, 2019
@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels Jun 19, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jun 19, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jun 20, 2019
@Jaykul
Copy link
Contributor

Jaykul commented Jun 22, 2019

Do we really want that? Would we then have to update it constantly?

What if users just set the title themselves using VT sequences, and we made information like that available in environment variables or via VT query responses ...

@DHowett-MSFT
Copy link
Contributor

@Jaykul if I could have convinced people that the VT title was all they needed, we wouldn’t have had a forty-comment-long discussion in #608 and a followup deliverable :(
For some reason, which is as yet non-obvious to me, people want a title that isn’t the one set by their app.

The moment they get that, they’ll complain that they’re not seeing their application title :p

@Jaykul
Copy link
Contributor

Jaykul commented Jun 22, 2019

Yeah, I'll help fight it there too 🙄 what we need is education, not configuration.
We have plenty of capability to set it however we want, already.

@DJackman123
Copy link
Contributor

The reason I want this feature is not because I don't know how to set the title from the console, but because the scripts that I run as part of my job keep changing the title. What's worse is these scripts don't know anything about tabbed console windows, so they set the title to something super long. I want much more control over the tab titles, regardless of what scripts try to do to them. When I use Terminal I will have many tabs open at a time, and I'd like each of the tab titles to be very concise so I can see as many tabs as possible without scrolling. This means being able to strip the "Administrator:" prefix to all of the tabs. (I'd much rather have the administrator status represented by the tab color or something else that doesn't take up valuable space in the tabs.) It would also be most helpful for the tab title to also tell me which tab number it is so I can quickly know which hotkey to use to change to that tab. The ideal would be for Terminal to let me provide a regular expression for extracting the most important parts of what the console app wants the title to be so I can have it display the most important information in the actual title, including whether or not the script I started in that tab is still running (to be represented in the tab by a single character, not a long string of text set by the script).
Is this something that's already possible with VT title? If more education is all that I need, please help me find the documentation for how to do this.

@Jaykul
Copy link
Contributor

Jaykul commented Aug 5, 2019

Well, the VT title just lets you set the title to whatever text you want. Unfortunately, it does not differentiate between "you" and "scripts that you run", and it doesn't (yet) have any extensibility you can configure.

I agree 100% with the desire to have the tab number prefix on the (first 10) tabs, so it's easy to switch via hotkeys without counting -- and that's basically impossible for the shell/scripts to do.

It might even be nice to be able to force a titlePrefix from the profile before whatever scripts try to set. That is, not just the tab number, but a word that represents the shell to me: "bash", "pwsh", "ubuntu", "wsl", "cmd", "PS7", etc. That way I could have tabs like:

  • 1️⃣ PS6: Deploying Az Templates [Step 2 of 132]
  • 2️⃣ CMD: C:\Windows\
  • 3️⃣ WSL: sh top*
  • 4️⃣ PS7: ~\Projects\Terminal
  • ... etc.

I wouldn't fight the idea of providing a regex to let you configure that, like: "(.*)", "{number} PS6: $1" or even "(?:Administrator|Admin)\s+(.*)", "{number} PS6: $1" or whatever 😁. After all (until Terminal has a way to launch "Admin" tabs side-by-side with non-admin tabs) it is totally redundant to have "Administrator" on every tab...

We'll definitely need a few other features for those prone to lots of tabs like

  • An option to shorten tabs to force all tabs on screen at once (down to a minimum tab width), regardless of title length
    • Mouse over tool tips of the full title
  • A list of the active tabs (maybe in the current new-tab menu)
    • The list could show up (like VS Code's does) on Ctrl+Tab (or only show up when there are tabs that aren't visible because of length)

DHowett-MSFT pushed a commit that referenced this issue Aug 14, 2019
### User Stories:

1. A user wants to be able to use the executable path as their starting title
    - Does anyone want this?
2. A user wants to be able to set a custom starting title, but have that title be overridable
3. A user wants to be able to set an overridable starting title, different from the profile name
    - Presumably someone will want this
4. A user totally wants to ignore the VT title and use something else
    - This will make more sense in the post [#1320] "Support runtime variables in the custom user title" settings

### Solutions:

1. `name`, `startingTitle`, `tabTitle`
    * a. `name` is only ever used as the profile name.
    * b. If `startingTitle` isn't set, then the executable path is used
    * c. If `startingTitle` is set, it's used as the initial title
    * d. If `tabTitle` is set, it overrides the title from the terminal
    * e. Current users of `tabTitle` need to manually update to the new behavior.
2. `name` as starting title, `tabTitle` as a different starting title
    * a. `name` is used as the starting title and the profile name in the dropdown
    * b. If `tabTitle` is set, we'll use that as the overridable starting title instead.
    * c. In the future, `dynamicTabTitle` or `tabTitleOverride` could be added to support [#1320]
    * d. Current users of `tabTitle` automatically get the new (different!) behavior.
    * e. User Story 1 is impossible
        - Does anyone want the behavior _ever_? Perhaps making that scenario impossible is good?
3. `name` unchanged, `tabTitle` as the starting title
    * a. `name` is only ever used as the profile name.
    * b. If `tabTitle` is set, we'll use that as the overridable starting title.
    * c. In the future, `dynamicTabTitle` or `tabTitleOverride` could be added to support [#1320]
    * d. Current users of `tabTitle` automatically get the new (different!) behavior.
4. `name` as starting title, `tabTitle` as different starting title, `suppressApplicationTitle` Boolean to force it to override
    * a. `name`, `tabTitle` work as in Solution 2.
    * b. When someone wants to be able to statically totally override that title (story 4), they can use `suppressApplicationTitle`
    * c. `suppressApplicationTitle` name is WIP
    * d.  We'll add `suppressApplicationTitle` when someone complains
    * e. If you really want story 1, use `tabTitle: c:\path\to\foo.exe` and `suppressApplicationTitle`.

[#1320]: #1320

We've decided to pursue path 4.
@lzybkr
Copy link
Member

lzybkr commented Nov 26, 2019

I'm all for a static but configurable title. I put the shell PID and an glyph for elevated sessions, otherwise the profile name is enough - assuming the auto-detect profiles for PowerShell and WSL could add a version.

image

donno2048 added a commit to donno2048/terminal that referenced this issue Sep 28, 2020
### User Stories:

1. A user wants to be able to use the executable path as their starting title
    - Does anyone want this?
2. A user wants to be able to set a custom starting title, but have that title be overridable
3. A user wants to be able to set an overridable starting title, different from the profile name
    - Presumably someone will want this
4. A user totally wants to ignore the VT title and use something else
    - This will make more sense in the post [#1320] "Support runtime variables in the custom user title" settings

### Solutions:

1. `name`, `startingTitle`, `tabTitle`
    * a. `name` is only ever used as the profile name.
    * b. If `startingTitle` isn't set, then the executable path is used
    * c. If `startingTitle` is set, it's used as the initial title
    * d. If `tabTitle` is set, it overrides the title from the terminal
    * e. Current users of `tabTitle` need to manually update to the new behavior.
2. `name` as starting title, `tabTitle` as a different starting title
    * a. `name` is used as the starting title and the profile name in the dropdown
    * b. If `tabTitle` is set, we'll use that as the overridable starting title instead.
    * c. In the future, `dynamicTabTitle` or `tabTitleOverride` could be added to support [#1320]
    * d. Current users of `tabTitle` automatically get the new (different!) behavior.
    * e. User Story 1 is impossible
        - Does anyone want the behavior _ever_? Perhaps making that scenario impossible is good?
3. `name` unchanged, `tabTitle` as the starting title
    * a. `name` is only ever used as the profile name.
    * b. If `tabTitle` is set, we'll use that as the overridable starting title.
    * c. In the future, `dynamicTabTitle` or `tabTitleOverride` could be added to support [#1320]
    * d. Current users of `tabTitle` automatically get the new (different!) behavior.
4. `name` as starting title, `tabTitle` as different starting title, `suppressApplicationTitle` Boolean to force it to override
    * a. `name`, `tabTitle` work as in Solution 2.
    * b. When someone wants to be able to statically totally override that title (story 4), they can use `suppressApplicationTitle`
    * c. `suppressApplicationTitle` name is WIP
    * d.  We'll add `suppressApplicationTitle` when someone complains
    * e. If you really want story 1, use `tabTitle: c:\path\to\foo.exe` and `suppressApplicationTitle`.

[#1320]: microsoft/terminal#1320

We've decided to pursue path 4.
@zadjii-msft
Copy link
Member Author

VS Code's implementation, for reference: https://code.visualstudio.com/updates/v1_61#_custom-title-and-description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
Specification Tracker
  
Spec Needed ❓
Development

No branches or pull requests

5 participants