[PR #19192] Use a new API to propagate foreground state to child processes #31742

Open
opened 2026-01-31 09:49:16 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/19192

State: closed
Merged: Yes


Windows 11 uses some additional signals to determine what the user cares
about and give it a bit of a QoS boost. One of those signals is whether
it is associated with a window that is in the foreground or which has
input focus.

Association today takes two forms:

  • Process has a window which is in the foreground or which has input
    focus
  • Process has a parent that meets the above criterion.

Console applications that are spawned "inside" terminal by handoff do
not fall into either bucket. They don't have a window. Their parent is
dllhost or explorer, who is definitely not in focus.

We are piloting a new API that allows us to associate those processes
with Terminal's window.

When Terminal is in focus, it will attach every process from the active
tab to its QoS group. This means that whatever is running in that tab
is put into the "foreground" bucket, and everything running in other
background tabs is not.

When Terminal is out of focus, it attaches every process to its QoS
group. This ensures that they all go into the "background" bucket
together, following the window.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/19192 **State:** closed **Merged:** Yes --- Windows 11 uses some additional signals to determine what the user cares about and give it a bit of a QoS boost. One of those signals is whether it is associated with a window that is in the foreground or which has input focus. Association today takes two forms: - Process has a window which is in the foreground or which has input focus - Process has a *parent* that meets the above criterion. Console applications that are spawned "inside" terminal by handoff do not fall into either bucket. They don't have a window. Their parent is `dllhost` or `explorer`, who is definitely not in focus. We are piloting a new API that allows us to associate those processes with Terminal's window. When Terminal is in focus, it will attach every process from the active tab to its QoS group. This means that whatever is running in that tab is put into the "foreground" bucket, and everything running in other background tabs is not. When Terminal is out of focus, it attaches every process to its QoS group. This ensures that they all go into the "background" bucket together, following the window.
claunia added the pull-request label 2026-01-31 09:49:16 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31742