Skip to content

[2.x] feat: Set terminal window title when running applications#8492

Merged
eed3si9n merged 4 commits intosbt:developfrom
MkDev11:feature/window-title-7586
Jan 12, 2026
Merged

[2.x] feat: Set terminal window title when running applications#8492
eed3si9n merged 4 commits intosbt:developfrom
MkDev11:feature/window-title-7586

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 12, 2026

feat: Set terminal window title when running applications

What's the problem?

When you have multiple microservices running with sbt run, all terminal windows show the same title ("sbt run" or just "sbt"). This makes it hard to tell which service is running in which window without stopping the app or guessing from log messages.

What's the fix?

Now when you run sbt run, runMain, bgRun, or bgRunMain, the terminal window title is automatically set to show the project info:

sbt run: com.example % my-service % 1.0.0

This makes it easy to identify which service is running in each terminal window at a glance.

How it works

Uses standard ANSI escape codes to set the terminal title. Only activates when running in a proper terminal (checks for TERM environment variable).

Testing

  • Compiled successfully
  • scalafmtCheck passed

Fixes #7586


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147

@eed3si9n
Copy link
Copy Markdown
Member

sbt 2.x has three kinds of run (https://eed3si9n.com/sudori-part7-client-side-run-with-sbt/):

  1. client-side (sbtn) run
  2. server-side in-process run
  3. server-side forked run

The default behavior is client-side run, which means sbt server code just sends JSON signal to sbtn, and sbtn would fork a java process do run the user program. This means, we'd probably want to replicate the window title changing code to sbtn as well. The sbtn client-side run code is around here:

@eed3si9n eed3si9n changed the title feat: Set terminal window title when running applications [2.x] feat: Set terminal window title when running applications Jan 12, 2026
Set window title to 'sbt <command>: <org> % <name> % <version>' when
running sbt run, runMain, bgRun, or bgRunMain.

For server-side runs, window title is set directly.
For client-side runs (sbtn), window title is passed via RunInfo protocol
and set by NetworkClient.

Fixes sbt#7586
@MkDev11 MkDev11 force-pushed the feature/window-title-7586 branch 2 times, most recently from af3a0cf to 8dd1e6d Compare January 12, 2026 05:15
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits, but overall LGTM. Thanks!

@MkDev11 MkDev11 force-pushed the feature/window-title-7586 branch 2 times, most recently from 9cb9dd9 to 91141ca Compare January 12, 2026 06:01
Set window title to 'sbt <command>: <org> % <name> % <version>' when
running sbt run, runMain, bgRun, or bgRunMain.

For server-side runs, window title is set directly.
For client-side runs (sbtn), window title is passed via RunInfo protocol
and set by NetworkClient.

Fixes sbt#7586
@MkDev11 MkDev11 force-pushed the feature/window-title-7586 branch from eb7fe75 to 30c7625 Compare January 12, 2026 06:19
@eed3si9n eed3si9n merged commit add43bd into sbt:develop Jan 12, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set window title to organization + artifactId + sbt command

2 participants