microsoft/Terminal

Support runtime variables in the custom user title

Open

#1 320 ouverte le 19 juin 2019

Voir sur GitHub
 (7 commentaires) (5 réactions) (0 assignés)C++ (3 212 forks)batch import
Area-UserInterfaceHelp WantedIssue-FeatureProduct-Terminal

Métriques du dépôt

Stars
 (35 764 stars)
Métriques de merge PR
 (Merge moyen 27j 19h) (24 PRs mergées en 30 j)

Description

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

  • What syntax do we chose for these custom variables?
  • What variables should we include?
    • We should probably avoid any that'd be better served by a shell setting the title
    • #2396 We should be able to conditionally put "Administrator" in the title
    • #13241 - similarly, with the shield emoji
    • #18890 - the window name
  • Do we need to register change event handlers for each variable that they've put in the title? How do we handle that?
  • Should we enable conditional elements in the string? e.g. "{isAdmin?\"Admin\":\"\"} - {title}" to get "Admin - cmd.exe"
    • Another example - "{name} [{numberOfPanes<10?numberOfPanes : \"9+\"}]" for "Powershell [2]" or "Powershell [9+]"
    • Another example - how would we get "Powershell" for 1 pane, but then "Powershell [+1]" for 2 panes? How would we encode the entire [+{numberOfPanes}] bit should be conditional on there being more than one pane? Could we combine this with the above case, and have nested conditionals?
      • Does all of this basically mean embedding an entire scripting language into the tabTitle?
  • Request: "Tab title" text resolves environment variables #10144
  • #9929, #13506

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.


Something we probably need to comport with #4183

Are we setting the title per-pane or per window? That affects how we structure the variables

Guide contributeur