microsoft/Terminal

Support runtime variables in the custom user title

Open

#1,320 建立於 2019年6月19日

在 GitHub 查看
 (7 留言) (5 反應) (0 負責人)C++ (3,212 fork)batch import
Area-UserInterfaceHelp WantedIssue-FeatureProduct-Terminal

倉庫指標

Star
 (35,764 star)
PR 合併指標
 (平均合併 27天 19小時) (30 天內合併 24 個 PR)

描述

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

貢獻者指南