[PR #9137] Force activate existing windows when running a commandline in them #27447

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

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

State: closed
Merged: Yes


This will make sure to summon the terminal window when running a
commandline in it.

  • If the window is on another desktop, the OS will switch to the desktop
    the window is on.
  • If the window is minimized, it will restore it.

This is taken from my quake mode branch. It works aggressively. 848682a,
fee6473, 342d3f2, 5052d31 all had other attempts at doing this, but they
didn't work reliably. Part of the trick is that I don't think Windows
wants one process to be able to move another process into the
foreground. In this case though, we do want to move ourself into the
foreground, and this AttachThreadInput hack seems to be the only way
to do it reliably.

References #5000
Uses code authored for #653

Closes https://github.com/microsoft/terminal/projects/5#card-54636373

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9137 **State:** closed **Merged:** Yes --- This will make sure to summon the terminal window when running a commandline in it. * If the window is on another desktop, the OS will switch to the desktop the window is on. * If the window is minimized, it will restore it. This is taken from my quake mode branch. It works aggressively. 848682a, fee6473, 342d3f2, 5052d31 all had other attempts at doing this, but they didn't work reliably. Part of the trick is that I don't _think_ Windows wants one process to be able to move another process into the foreground. In this case though, we _do_ want to move ourself into the foreground, and this `AttachThreadInput` hack seems to be the only way to do it reliably. References #5000 Uses code authored for #653 Closes https://github.com/microsoft/terminal/projects/5#card-54636373
claunia added the pull-request label 2026-01-31 09:22:01 +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#27447