terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Allowing headless mode (running in the background) prevents Windows Terminal from opening again

Open oliver-leung opened this issue 7 months ago • 4 comments

Windows Terminal version

1.22.11141.0

Windows build number

10.0.26100.0

Other Software

No response

Steps to reproduce

  1. Open Windows Terminal
  2. Go to Settings > Compatibility, and turn on "Allow Windows Terminal to run in the background"
    1. Alternatively, open settings.json and set "compatibility.allowHeadless": true
  3. Save settings
  4. Close Windows Terminal
  5. Attempt to open Windows Terminal

Expected Behavior

Windows Terminal opens

Actual Behavior

Windows Terminal does not open


In order to get out of this situation, I need to do one of the following:

Option 1

  1. Reboot my PC
  2. Open Windows Terminal (this will only work for the first attempt after booting)
  3. Go to Settings > Compatibility, and turn off "Allow Windows Terminal to run in the background"
  4. Save settings

Option 2

  1. Open settings.json and set "compatibility.allowHeadless": false
  2. Reboot my PC (importantly, this must be done after disallowing headless mode)

I suspect that the issue is that, after allowing headless mode, there is a background process for Windows Terminal running. The fact that this process is running prevents any new Windows Terminal windows from opening. However, I can't figure out which background process is responsible.

oliver-leung avatar Apr 26 '25 18:04 oliver-leung

That background process is likely WindowsTerminal.exe.

We don't have any other background processes in that mode. :)

DHowett avatar Apr 26 '25 21:04 DHowett

I searched for "terminal" in Task Manager processes, and didn't find anything, but I still couldn't open Windows Terminal

oliver-leung avatar Apr 27 '25 02:04 oliver-leung

It's WindowsTerminal. Not just Terminal!

If it isn't running, you don't have headless mode. :)

DHowett avatar Apr 27 '25 02:04 DHowett

When I first tried this, I searched for both "terminal" and "windowsterminal", and nothing showed up. Somehow, I do now see WindowsTerminal.exe in Task Manager when I didn't before. Can't seem to upload a screen capture directly to GitHub, but I uploaded it to Google Drive: https://drive.google.com/file/d/1AeIwSi0Z0h5u9ERfhxxNT7h377F4tzwO/view?usp=sharing

Anyways, it isn't a very good experience to end up in this terminal (no pun intended😛) state with no clear indication as to why Terminal won't open anymore. Sure, I can get myself out of it by ending the process, but other users might not know the exact process name to search for.

oliver-leung avatar Apr 27 '25 02:04 oliver-leung

@oliver-leung try press SHIFT when clicking on LNK

Zeroes1 avatar Apr 29 '25 23:04 Zeroes1

Curious, do you also have "windowingBehavior": "useExisting" in your settings.json (tracking that over in #18827)? If not, can you share a copy of your settings.json file /?

carlos-zamora avatar Apr 30 '25 21:04 carlos-zamora

@Zeroes1 Holding down Shift and clicking on the .lnk doesn't work, unfortunately.

@carlos-zamora That's it! I actually had "windowingBehavior": "useAnyExisting", which wasn't mentioned in #18827, but it seems that both "useAnyExisting" and "useExisting" prevent Terminal from reopening. "useNew" was the only option that allowed me to reopen Terminal.

Is the "useAnyExisting" case addressed in #18623? If so, I'm fine to close out this issue 👍

oliver-leung avatar May 02 '25 00:05 oliver-leung

Great! I'll close this out as a /duplicate of #18827. And good feedback, I'll update that bug title to be more clear since it looks like quite a few people are hitting this scenario. 😊

Is the "useAnyExisting" case addressed in #18623?

Ah, so that one's on me. It was "fixed" as a part of the big windowing refactor started in #18215 which is available in v1.23.10732.0 (the current Preview channel). We're planning on promoting 1.23 to the stable channel, but we still have a few more fixes in this area we want to do before promoting it.

#18827 tracks doing a servicing fix for 1.22 in the meantime.

carlos-zamora avatar May 02 '25 17:05 carlos-zamora

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!