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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9137
Author: @zadjii-msft
Created: 2/12/2021
Status: Merged
Merged: 2/17/2021
Merged by: @undefined

Base: mainHead: dev/migrie/f/ACTIVATE


📝 Commits (5)

  • ed5b3d6 Fix the Host Proxy DLL reference in ServerLib
  • 007fcee Merge remote-tracking branch 'origin/dev/duhowett/iproxy' into dev/migrie/f/ACTIVATE
  • 73ded76 When running a commandline in an existing window, ACTIVATE that window (by force)
  • ed172c9 some cleanup from review
  • 4fb0d59 Merge remote-tracking branch 'origin/main' into dev/migrie/f/ACTIVATE

📊 Changes

4 files changed (+41 additions, -0 deletions)

View changed files

📝 src/cascadia/WindowsTerminal/AppHost.cpp (+1 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.cpp (+36 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.h (+2 -0)
📝 src/cascadia/WindowsTerminal/pch.h (+2 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9137 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/12/2021 **Status:** ✅ Merged **Merged:** 2/17/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/f/ACTIVATE` --- ### 📝 Commits (5) - [`ed5b3d6`](https://github.com/microsoft/terminal/commit/ed5b3d6b863389e036fb5db4e8e50b01803229d0) Fix the Host Proxy DLL reference in ServerLib - [`007fcee`](https://github.com/microsoft/terminal/commit/007fcee7f7e9cae0c4667fb3fa0dfc02bc5be61c) Merge remote-tracking branch 'origin/dev/duhowett/iproxy' into dev/migrie/f/ACTIVATE - [`73ded76`](https://github.com/microsoft/terminal/commit/73ded760d15a8ac3800c6793b60dd311efcbd7a6) When running a commandline in an existing window, ACTIVATE that window (by force) - [`ed172c9`](https://github.com/microsoft/terminal/commit/ed172c9e87760be356075c97173d0297e283590d) some cleanup from review - [`4fb0d59`](https://github.com/microsoft/terminal/commit/4fb0d5919a1559eb69e8987de8c632e89a1ce6b6) Merge remote-tracking branch 'origin/main' into dev/migrie/f/ACTIVATE ### 📊 Changes **4 files changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+1 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.cpp` (+36 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.h` (+2 -0) 📝 `src/cascadia/WindowsTerminal/pch.h` (+2 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:22:00 +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#27442