Skip to content

workspace: Add configurable window title formatting#54379

Open
jknlsn wants to merge 2 commits into
zed-industries:mainfrom
jknlsn:feat/title-template
Open

workspace: Add configurable window title formatting#54379
jknlsn wants to merge 2 commits into
zed-industries:mainfrom
jknlsn:feat/title-template

Conversation

@jknlsn
Copy link
Copy Markdown
Contributor

@jknlsn jknlsn commented Apr 21, 2026

Summary

  • Add window_title_format and window_title_separator settings for customizing the window title
  • Expose ${projectName}, ${fileName}, ${filePath}, ${relativePath}, ${fileStem}, ${remoteName}, ${remoteHost}, ${appName}, and ${separator} as the native Zed window-title variables
  • Keep the collab ↗/↙ indicator hard-appended
  • Translate VS Code window.title / window.titleSeparator aliases into Zed's canonical variables during settings import, including ${appName} passthrough support and mapping VS Code's ${activeEditorMedium} onto Zed's ${relativePath}
  • Gate path-, remote-, and release-channel-derived lookups on whether the active template references the corresponding variable, so the default template avoids the extra work and still uses the existing last_window_title cache to skip redundant platform updates

An alternative approach is at #49638. I went with ${variable} names over $ZED_*, canonical Zed variable names with VS Code aliases handled at import time, kept ${separator} as the only structural token, and left ${dirty} out of scope.

Implementation reasoning and notes

Variables considered but not included

  • collab/shared indicator variable: kept hard-appended instead. Folding it into the template would need whitespace/separator logic the other variables don't need, and I'd rather not bake those semantics in without a concrete need for it.
  • dirty variable: The glyph choice and interaction with OS-level edited indicators (like macOS's titlebar dot via set_window_edited) felt like a separate design call I wasn't confident making here.

A separator-style config for each of collab/shared/dirty would solve the above, but I didn't want to add too many additional settings initially.

Performance

update_window_title is on a hot path, so two short-circuits apply:

  • Path-, remote-, and release-channel-derived lookups (absolute_path, relative-path string, file_stem, remote_connection_options, ReleaseChannel::try_global) are gated on template.contains(...) via WindowTitleNeeds::from_template, so the default template avoids the extra work.
  • The existing last_window_title cache still skips the platform call when the rendered title is unchanged.

Screenshots

Settings Editor entries for window_title_format and window_title_separator:
Settings Editor screenshot

Customized Zed window titles in AltTab app switcher (remote, local, empty):
AltTab app switcher screenshot

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Closes #14534

Release Notes:

  • Added configurable window title formatting with window_title_format / window_title_separator, including ${appName} / ${remoteName} / ${remoteHost} variables and VS Code window.title import support

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 21, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 21, 2026
@jknlsn jknlsn force-pushed the feat/title-template branch 3 times, most recently from b758c25 to 97c3428 Compare April 24, 2026 05:01
@jknlsn jknlsn mentioned this pull request Apr 24, 2026
1 task
@jknlsn jknlsn force-pushed the feat/title-template branch 4 times, most recently from 5035009 to f110145 Compare April 29, 2026 22:26
@jknlsn jknlsn force-pushed the feat/title-template branch 9 times, most recently from c81ecd1 to ebad356 Compare May 10, 2026 03:28
@jknlsn jknlsn force-pushed the feat/title-template branch 7 times, most recently from cbe240f to 9a0aefd Compare May 17, 2026 18:53
@jknlsn jknlsn force-pushed the feat/title-template branch 4 times, most recently from 986c9b5 to 55a72d9 Compare May 25, 2026 18:40
@jknlsn jknlsn force-pushed the feat/title-template branch 4 times, most recently from b150a38 to 5f1695c Compare June 2, 2026 07:54
@jknlsn jknlsn force-pushed the feat/title-template branch 2 times, most recently from a4f584d to 959378f Compare June 4, 2026 18:01
@jknlsn jknlsn force-pushed the feat/title-template branch from 959378f to eb0a5a3 Compare June 6, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure window title pattern

1 participant