Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for running the Terminal without _any_ windows #14944

Merged
merged 134 commits into from
Apr 6, 2023

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Mar 2, 2023

This adds a setting (compatibility.allowHeadless) to let the Terminal keep running even when all windows are closed. This lets hotkeys keep working, because the Emperor thread is still running, just, without any windows.

I'm really tempted to invoke the magic "closes" word on #9996, but honestly, we should also add some sort of support for wt --headless or wt --hidden or whatever, before we close that. There's also #13630 which seems imminently doable.

Tested manually. I'd post a gif of "close all terminal windows, then invoke the quakeMode binding and *presto*, but that would be an unnecessarily big gif.

Related to #9996 but not enough to close it if you ask me

…ing AppLogic that I hate so I'm gonna start over
  We'll need this for #5000, for ainulindale. This refactoring will be annoying
  enough as it is so we may as well do it as a first, separate PR.
…ndale

# Conflicts:
#	src/cascadia/WindowsTerminal/AppHost.h
…XAML island is started.

  I think this can work in the parent at least
…It launches and crashes immediately. We'll keep shuffling code.
  At this point, I determined that I would need to make some big changes to
  AppHost and decided that it was time to commit before moving on.
…pressive

  It exits itself after 30s, but hey it worked
  Doesn't work with multiple windows open, but doesn't do _nothing_

(cherry picked from commit 427a4a5)
…ut this doesn't fix the crash

(cherry picked from commit 700aadc)
  TerminalPage is the thing that ends up expanding iterable Command. It does
  this largely with copies - it makes a new map, a new vector, copies the
  Commands over, and does the work there before setting up the cmdpal.

  Except, it's not making a copy of the Commands, it's making a copy of the
  vector, with winrt objects all pointing at the Command objects that are
  ultimately owned by CascadiaSettings.

  This doesn't matter if there's only one TerminalPage - we'll only ever do that once.

  If there's many, on different threads, then one tpage will end up expanding
  the subcommands of one Command while another tpage is ALSO iterating on those
  subcommands. Hence why I'm getting `hresult_changed_state`s

(cherry picked from commit 2122eec)
  32 TODOs
  Each page was registering as a handoff target, so basically we'd start the
  server then yeet the connection back to the first window and presto, you'd
  have a dead window and a connection on the wrong thread and everything was
  awful. Instead, only register as the handoff listener when we've actually said
  we want to be a handoff listener.
…lindale

# Conflicts:
#	src/cascadia/TerminalApp/AppLogic.cpp
#	src/cascadia/TerminalApp/AppLogic.h
#	src/cascadia/TerminalApp/AppLogic.idl
#	src/cascadia/TerminalApp/TerminalPage.h
#	src/cascadia/TerminalApp/TerminalWindow.cpp
#	src/cascadia/TerminalApp/TerminalWindow.h
#	src/cascadia/TerminalSettingsModel/GlobalAppSettings.cpp
#	src/cascadia/TerminalSettingsModel/GlobalAppSettings.h
#	src/cascadia/TerminalSettingsModel/GlobalAppSettings.idl
#	src/cascadia/WindowsTerminal/AppHost.cpp
#	src/cascadia/WindowsTerminal/AppHost.h
Base automatically changed from dev/migrie/oop/3/ainulindale to main March 17, 2023 22:59
@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Area-Windowing Window frame, quake mode, tearout labels Mar 20, 2023
Copy link
Contributor

@PankajBhojwani PankajBhojwani left a comment

Choose a reason for hiding this comment

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

Looks good, just had 1 question - do we want to add AllowHeadless to the settings ui?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 31, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Apr 5, 2023
@zadjii-msft
Copy link
Member Author

@PankajBhojwani I was starting to roll together a "Compatibility" page for the SUI that has that (and other things we've talked about in the past), so I was gonna leave it out for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants