Compare commits

...

134 Commits

Author SHA1 Message Date
Mike Griese
c111b6c7ba WIP 2023-03-27 15:54:41 -05:00
Mike Griese
9942d55395 Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/feanor-and-the-unchaining-of-melkor 2023-03-24 15:29:12 -05:00
Mike Griese
10913b8f1a Merge branch 'main' into dev/migrie/oop/3/feanor-and-the-unchaining-of-melkor 2023-03-20 10:54:55 -05:00
Mike Griese
d08d8ab01b Merge remote-tracking branch 'origin/dev/migrie/oop/3/ainulindale' into dev/migrie/oop/3/feanor-and-the-unchaining-of-melkor 2023-03-20 09:36:28 -05:00
Mike Griese
1e4cc330aa Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/ainulindale 2023-03-17 15:18:19 -05:00
Mike Griese
55ee49b893 Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/ainulindale
# 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
2023-03-17 12:17:02 -05:00
Mike Griese
11f995793c [ainulindale] Friendship ended with callbacks 2023-03-17 11:51:26 -05:00
Mike Griese
d55bb43f47 [ainulindale] windows should get activated when they're created 2023-03-17 09:33:37 -05:00
Mike Griese
7142ae88c9 [ainulindale] fix defterm
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.
2023-03-17 09:32:57 -05:00
Mike Griese
59b07f1b41 Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-03-17 09:31:22 -05:00
Mike Griese
5b3dc083e0 last nits, let's do this 2023-03-17 08:42:41 -05:00
Mike Griese
0808f94cd0 Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/foreword 2023-03-17 08:29:05 -05:00
Mike Griese
155bc983c1 [unchaining of melkor] Y'know, maybe this isn't a sensible default after all 2023-03-14 05:56:12 -05:00
Mike Griese
6aec80b8e7 A hotfix for the selfhost build 2023-03-13 11:31:49 -05:00
Mike Griese
6a0b1cdbdc Merge branch 'dev/migrie/oop/3/ainulindale' into dev/migrie/oop/3/feanor-and-the-unchaining-of-melkor 2023-03-10 16:26:13 -06:00
Mike Griese
9957e5ce52 I think that's the last of the nits 2023-03-10 15:53:45 -06:00
Mike Griese
1138416dc9 hey let's make sure it still works 2023-03-10 15:23:28 -06:00
Mike Griese
6d043532fc yea we can fold this in 2023-03-10 14:58:10 -06:00
Mike Griese
339972ecea tests build and pass again 2023-03-10 14:34:46 -06:00
Mike Griese
81140a530e Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-03-10 10:46:53 -06:00
Mike Griese
f70775aca0 I don't trust you phyllis 2023-03-10 10:04:54 -06:00
Mike Griese
ca511c9cc9 this is why I don't use VS 2023-03-10 09:04:05 -06:00
Mike Griese
073350e66f fix the tests too 2023-03-10 09:02:46 -06:00
Mike Griese
44b238e777 Redo how ownership of WindowProperties works. This is cleaner by a good amount 2023-03-09 16:55:05 -06:00
Mike Griese
39a94503fc to wit, also make sure that there is a tablayout 2023-03-09 13:51:43 -06:00
Mike Griese
1b59eb9238 save this for later, we should only need ot look it up once 2023-03-09 13:50:13 -06:00
Mike Griese
434abc2474 Remove the need for TerminalPage to know the number of open windows
This removes all the weirdness around the way that TerminalPage needs to track
  the number of open windows. Instead of TerminalPage persisting empty state
  when the last tab closes, it lets the AppHost know that the last tab was
  closed due to _closing the tab_ (as opposed to closing the window / quitting).
  This gives AppHost an opportunity to persist empty state for that case,
  because _it_ knows how many windows there are.

  This could basically be its own PR.

  Probably worth xlinking this commit to #9800
2023-03-09 12:52:28 -06:00
Mike Griese
6dead99341 PR nits 2023-03-09 12:29:23 -06:00
Mike Griese
77218139d8 pr nits 2023-03-09 10:13:50 -06:00
Mike Griese
6e4b2e1048 Guess what's LOAD BEARING 2023-03-09 09:27:48 -06:00
Mike Griese
1dc243641c weak refs for fun and profit 2023-03-08 16:13:19 -06:00
Mike Griese
6f6880c017 this is more idomatic locking cause it's actually locking 2023-03-08 15:18:27 -06:00
Mike Griese
547b2c9e6a you never get used either 2023-03-08 11:25:45 -06:00
Mike Griese
74af809b66 mmmm fresh cut code 2023-03-08 11:23:59 -06:00
Mike Griese
b0ca581b43 .detach so we don't std::explode() 2023-03-08 11:10:15 -06:00
Mike Griese
5fe3fa5ea8 some cleanup around expanding commands 2023-03-08 10:59:42 -06:00
Mike Griese
3fa101731b one fewer IReference, thank gods 2023-03-07 16:44:26 -06:00
Mike Griese
b24cf615ea some of the more minor cleanup elements 2023-03-07 16:28:38 -06:00
Mike Griese
9a9fa4392a [ainulindale] Prevent a race between the Emperor and the window logic when updating settings
(cherry picked from commit 35c7474abe)
2023-03-06 13:30:32 -06:00
Mike Griese
41827424db oh this SO could have been one commit
(cherry picked from commit 8428f666bf)
2023-03-02 16:24:11 -06:00
Mike Griese
2d6fbc97bf Merge branch 'dev/migrie/oop/3/quenta-silmarillion' into dev/migrie/oop/3/akallabeth
# Conflicts:
#	src/cascadia/TerminalApp/TerminalPage.h
2023-03-02 16:24:01 -06:00
Mike Griese
3aa083ba9a sure. It doesn't matter' 2023-03-02 14:00:09 -06:00
Mike Griese
b983c69c8e Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-03-02 13:22:01 -06:00
Mike Griese
88033246f1 spelling is hard 2023-03-02 11:18:02 -06:00
Mike Griese
08f6a53be5 This is gross but reduces the number of redundant copies of these brushes we need 2023-03-02 11:05:16 -06:00
Mike Griese
8e2c7a7bdd some cleanup 2023-03-02 10:20:59 -06:00
Mike Griese
1e331a037c Merge branch 'dev/migrie/oop/3/ainulindale' of https://github.com/microsoft/terminal into dev/migrie/oop/3/ainulindale 2023-03-02 09:54:09 -06:00
Mike Griese
5c852c3c4c some smaller nits 2023-03-02 09:54:04 -06:00
Mike Griese
7e2eb0d8e5 Apply suggestions from code review
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
2023-03-02 09:53:51 -06:00
Mike Griese
5164bffa78 hey that's a good point carlos 2023-02-28 12:04:24 -06:00
Mike Griese
ada3f427a0 well that is an underwhelming codeformat commit. Thanks VS 2023-02-28 11:56:37 -06:00
Mike Griese
5e23a72beb Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-28 11:55:17 -06:00
Mike Griese
0199aba286 the last nits, I think 2023-02-28 11:29:53 -06:00
Mike Griese
b589d092e9 Lots of PR nits 2023-02-28 11:22:29 -06:00
Mike Griese
cacb822cf6 Dustin wanted a setting to opt-in to isolated mode, and this seems to work 2023-02-27 10:16:22 -06:00
Mike Griese
b75fb24512 Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-27 09:34:59 -06:00
Mike Griese
c79f27c3da std::vectors are better 2023-02-27 08:32:18 -06:00
Mike Griese
273f2a84ef Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/foreword 2023-02-23 16:56:15 -06:00
Mike Griese
9a4739659b [ainulindale] The Terminal shouldn't crash on a WM_SETTINGCHANGE
(cherry picked from commit 7649725150)
2023-02-23 16:53:07 -06:00
Mike Griese
13257dafa0 0 TODOs remain 2023-02-16 11:11:09 -06:00
Mike Griese
ecab57fba1 that was quite silly 2023-02-16 11:10:06 -06:00
Mike Griese
091f32c575 a comment to go with the parent commit 2023-02-15 15:43:20 -06:00
Mike Griese
62a4ee058b https://media.tenor.com/knFWHfkiwoUAAAAC/im-fine-hades.gif 2023-02-15 15:39:23 -06:00
Mike Griese
2bc578bc6c Revert "I'm committing everything just in case, but I'm gonna revert and just do the part that fixed it"
This reverts commit 667b6586d2.
2023-02-15 15:33:49 -06:00
Mike Griese
667b6586d2 I'm committing everything just in case, but I'm gonna revert and just do the part that fixed it 2023-02-15 15:33:36 -06:00
Mike Griese
bc80943fd9 the tests all...pass? 2023-02-14 17:07:59 -06:00
Mike Griese
aa8b0c564d Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-14 16:47:11 -06:00
Mike Griese
118bffa6cd fix the tests 2023-02-14 15:51:18 -06:00
Mike Griese
3f9decaa82 Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-13 14:25:36 -06:00
Mike Griese
d9d4d2e62d get the tests to build, at least 2023-02-13 12:08:54 -06:00
Mike Griese
82224bc87a this was usnused 2023-02-13 11:48:32 -06:00
Mike Griese
a9ac218c4d runformat 2023-02-13 10:57:19 -06:00
Mike Griese
603a2ce53a spel 2023-02-13 10:56:31 -06:00
Mike Griese
2621519f20 cleanup for review 2023-02-13 10:46:37 -06:00
Mike Griese
1ec8c0de2e Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-13 09:30:23 -06:00
Mike Griese
a4f19a9dff spel 2023-02-13 09:28:13 -06:00
Mike Griese
33685d9e9d bwahahahahaha 2023-02-13 09:26:51 -06:00
Mike Griese
a76993365e merges are hard some times 2023-02-10 17:21:55 -06:00
Mike Griese
dffb41601b Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale 2023-02-10 17:09:29 -06:00
Mike Griese
e40575b18b let's do it 2023-02-10 16:50:58 -06:00
Mike Griese
cfa61088fe Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/foreword 2023-02-10 13:24:49 -06:00
Mike Griese
0ad5b596bd I think it's ready for review 2023-02-10 13:24:15 -06:00
Mike Griese
7660937139 and with that, we're ready to cleanup for review.
2 TODOs left
2023-02-10 13:05:57 -06:00
Mike Griese
45487294a0 Some additional cleanup of the WindowManager code
3 TODOs left
2023-02-10 11:16:37 -06:00
Mike Griese
f904e5d22d I give up and am moving on to the next TODOs. 8 TODOs remain 2023-02-10 09:48:08 -06:00
Mike Griese
0395dc40a3 Revert "This actually seems to make the lifetime management worse - we just dtor the WindowEmperor randomly now, which is no good"
This reverts commit 7e91bdb289.
2023-02-09 16:39:15 -06:00
Mike Griese
7e91bdb289 This actually seems to make the lifetime management worse - we just dtor the WindowEmperor randomly now, which is no good 2023-02-09 16:39:07 -06:00
Mike Griese
c69f0bc444 Quake logic seems to work again.
Down to just 10 TODOs left
2023-02-09 14:16:27 -06:00
Mike Griese
e214624e1f Re-add support for the notification icon.
14 TODOs left
2023-02-09 13:52:44 -06:00
Mike Griese
b0726c2057 Handle Quit actions
16 TODOs
2023-02-09 12:54:23 -06:00
Mike Griese
055da357b1 Readd ShouldImmediatelyHandoffToElevated
17 TODOs remain
2023-02-09 12:33:43 -06:00
Mike Griese
950ce6c4fc make pane brushes a member variable, which is good enough
(cherry picked from commit 7bad8c9642)
2023-02-09 12:27:19 -06:00
Mike Griese
0b79e81ae9 Summoning works, except for making new windows, but DANG 2023-02-09 11:03:10 -06:00
Mike Griese
a7379ca8e9 It so SO works 2023-02-09 10:51:50 -06:00
Mike Griese
4d5f6d27fb cleanup. 18 TODOs remain 2023-02-08 17:26:33 -06:00
Mike Griese
3fb8e8cac3 Hey this worked!
The trick is, that if you do this while debugging, the AppState will get persisted as you're stepping through, which can make debugging this really tricky
2023-02-08 17:13:15 -06:00
Mike Griese
6e6d14e0dc We're getting closer to loading up the previous state, but it doesn't always work as expected
20 TODOs left
2023-02-08 15:29:04 -06:00
Mike Griese
a5a9930354 Hey look I brought two windows back into existence!...
They weren't from the persisted JSON, but they did come back

  21 TODOs left
2023-02-08 13:25:41 -06:00
Mike Griese
0f4c4d8eef It persists, but it doesn't restore yet.
21 TODOs left
2023-02-08 12:56:22 -06:00
Mike Griese
8bb839113a move more window persist code around.
It doesn't save or restore, but it does seem to not crash.

  24 TODOs left
2023-02-08 12:42:12 -06:00
Mike Griese
dc1ae9a895 Starting to move these things to the right places 2023-02-08 12:08:28 -06:00
Mike Griese
84e228f1fe Start to move window restoration into the Emperor
I think I have a vision for it now. 25 TODOs left.
2023-02-08 11:05:43 -06:00
Mike Griese
3026922e59 Fix the window name not updating as it changed. Added some notes, so, 26 TODOs left 2023-02-08 09:57:45 -06:00
Mike Griese
64257d830a This straight up isn't even used in main anymore, 26 TODOs left 2023-02-08 09:31:58 -06:00
Mike Griese
4db381e2cb not totally happy with this, but I understand why. 29 TODOs left 2023-02-08 09:10:09 -06:00
Mike Griese
40fdbc1536 Hey this comment was TODOne, 29 TODOs left 2023-02-08 09:02:32 -06:00
Mike Griese
07ff4183e4 Plumb initial load result into the window on startup
30 TODOs left
2023-02-08 09:01:48 -06:00
Mike Griese
d5396d1104 UWP is dead
32 TODOs
2023-02-08 08:45:05 -06:00
Mike Griese
93e9dc505d I guess we need to just hardcode these sizes. Sad, but okay.
33 TODOs
2023-02-08 08:44:49 -06:00
Mike Griese
761bd6a6ab This one was dead code, 34 TODOs left 2023-02-08 08:07:38 -06:00
Mike Griese
23c4d4c0f8 Move the initialization of the showHide Throttler after we init the dispatcher.
35 TODOs left
2023-02-08 08:05:46 -06:00
Mike Griese
4e7da2ec13 I guess this is just dead now
36 TODOs
2023-02-08 06:51:44 -06:00
Mike Griese
2332f0c0e4 Don't try to snap on create if we're not prepared to snap
37 TODOs left
2023-02-08 06:51:29 -06:00
Mike Griese
2822c36507 [ainulindale] Expand commands in the AppLogic, not on each page
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 2122eec186)
2023-02-07 17:04:25 -06:00
Mike Griese
f06e484324 [ainulindale] This I'm confident fixes some of the x-thread errors, but this doesn't fix the crash
(cherry picked from commit 700aadcb15)
2023-02-07 17:03:41 -06:00
Mike Griese
9924e23dec [ainulindale] "fix" hot reload
Doesn't work with multiple windows open, but doesn't do _nothing_

(cherry picked from commit 427a4a51c5)
2023-02-07 17:02:25 -06:00
Mike Griese
47336c0982 [ainulindale] Clean tear down the App when the process exits
(cherry picked from commit 57d1dd4358)
2023-02-07 17:00:28 -06:00
Mike Griese
e623299ac6 notes 2023-02-01 14:12:31 -06:00
Mike Griese
274d62d8a8 it's working 2023-02-01 13:56:40 -06:00
Mike Griese
f655296c1e This does successfully get a window on the screen, which is pretty impressive
It exits itself after 30s, but hey it worked
2023-02-01 13:15:44 -06:00
Mike Griese
7a3e2e098d Start rewriting WindowManager to facilitate the new process model
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.
2023-02-01 11:48:43 -06:00
Mike Griese
2c4613a494 wow it just... worked 2023-02-01 08:07:29 -06:00
Mike Griese
f5b030c28c it runs! 2023-01-31 15:21:29 -06:00
Mike Griese
d456210f37 Use the single AppLogic for all windows. Remove the _app references. It launches and crashes immediately. We'll keep shuffling code. 2023-01-31 12:59:30 -06:00
Mike Griese
af14c2b751 [TO PARENT] Move the page ctor call, so that it can happen after the XAML island is started.
I think this can work in the parent at least
2023-01-31 12:58:39 -06:00
Mike Griese
ef7e2edfa5 Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainulindale
# Conflicts:
#	src/cascadia/WindowsTerminal/AppHost.h
2023-01-31 11:11:35 -06:00
Mike Griese
5116ca1e77 I think the todo's that are left, we can move on without them for now. 2023-01-31 10:47:46 -06:00
Mike Griese
2195515937 it launches 2023-01-31 10:44:38 -06:00
Mike Griese
99bc280207 It doesn't crash on launch. That's something. There's no startupActions though, so it immediately exits 2023-01-31 09:34:02 -06:00
Mike Griese
439b21f879 this is dangerously close to compiling 2023-01-30 17:06:31 -06:00
Mike Griese
936c01f948 Start splitting AppLogic into AppLogic and Window logic
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.
2023-01-30 14:52:19 -06:00
Mike Griese
e6220b7fe7 Revert "I don't think I want any of these"
This reverts commit a5255ba8ed.
2023-01-30 12:37:35 -06:00
Mike Griese
a5255ba8ed I don't think I want any of these 2023-01-30 12:37:26 -06:00
Mike Griese
581acd40d9 I definitely want all of this. But I started down a path for refactoring AppLogic that I hate so I'm gonna start over 2023-01-30 12:37:12 -06:00
14 changed files with 62 additions and 5 deletions

View File

@@ -666,6 +666,15 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
// window.
return winrt::make<Remoting::implementation::ProposeCommandlineResult>(false);
}
for (const auto& arg : args.Commandline())
{
if (args == L"--headless")
{
_HeadlessMode = true;
}
}
// If there's a valid ID returned, then let's try and find the peasant
// that goes with it. Alternatively, if we were given a magic windowing
// constant, we can use that to look up an appropriate peasant.

View File

@@ -81,6 +81,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
Windows::Foundation::Collections::IVector<winrt::hstring> GetAllWindowLayouts();
WINRT_PROPERTY(bool, HeadlessMode, false);
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);

View File

@@ -70,6 +70,8 @@ namespace Microsoft.Terminal.Remoting
Windows.Foundation.Collections.IVectorView<PeasantInfo> GetPeasantInfos { get; };
Windows.Foundation.Collections.IVector<String> GetAllWindowLayouts();
Boolean HeadlessMode { get; };
event Windows.Foundation.TypedEventHandler<Object, FindTargetWindowArgs> FindTargetWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> ShowNotificationIconRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> HideNotificationIconRequested;

View File

@@ -33,6 +33,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
WINRT_PROPERTY(Windows::Foundation::IReference<uint64_t>, Id);
WINRT_PROPERTY(winrt::hstring, WindowName);
WINRT_PROPERTY(bool, ShouldCreateWindow, true);
WINRT_PROPERTY(bool, HeadlessMode, false);
public:
ProposeCommandlineResult(bool shouldCreateWindow) :

View File

@@ -193,14 +193,20 @@ void AppCommandlineArgs::_buildParser()
};
_app.add_option_function<std::string>("--size", sizeCallback, RS_A(L"CmdSizeDesc"));
_app.add_option("-w,--window",
_windowTarget,
RS_A(L"CmdWindowTargetArgDesc"));
auto windowTarget = _app.add_option("-w,--window",
_windowTarget,
RS_A(L"CmdWindowTargetArgDesc"));
_app.add_option("-s,--saved",
_loadPersistedLayoutIdx,
RS_A(L"CmdSavedLayoutArgDesc"));
auto headless = _app.add_option("--headless",
_headless,
RS_A(L"CmdHeadlessArgDesc"));
_windowTarget->excludes(headless);
// Subcommands
_buildNewTabParser();
_buildSplitPaneParser();
@@ -918,7 +924,7 @@ void AppCommandlineArgs::ValidateStartupCommands()
// Only check over the actions list for the potential to add a new-tab
// command if we are not starting for the purposes of receiving an inbound
// handoff connection from the operating system.
if (!_isHandoffListener)
if (!_isHandoffListener && !_headless)
{
// If we parsed no commands, or the first command we've parsed is not a new
// tab action, prepend a new-tab command to the front of the list.
@@ -1085,6 +1091,7 @@ void AppCommandlineArgs::FullResetState()
_exitMessage = "";
_shouldExitEarly = false;
_isHandoffListener = false;
_isHandoffListener = false;
_windowTarget = {};
}

View File

@@ -124,12 +124,15 @@ private:
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> _position{ std::nullopt };
std::optional<til::size> _size{ std::nullopt };
bool _isHandoffListener{ false };
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
std::string _exitMessage;
bool _shouldExitEarly{ false };
int _loadPersistedLayoutIdx{};
std::string _windowTarget{};
bool _headless{ false };
// Are you adding more args or attributes here? If they are not reset in _resetStateToDefault, make sure to reset them in FullResetState
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs _getNewTerminalArgs(NewTerminalSubcommand& subcommand);

View File

@@ -703,6 +703,16 @@ namespace winrt::TerminalApp::implementation
globals.MinimizeToNotificationArea();
}
bool AppLogic::AllowHeadless()
{
if (!_loadedInitialSettings)
{
// Load settings if we haven't already
ReloadSettings();
}
return _settings.GlobalSettings().AllowHeadless();
}
TerminalApp::TerminalWindow AppLogic::CreateNewWindow()
{
if (_settings == nullptr)

View File

@@ -67,6 +67,7 @@ namespace winrt::TerminalApp::implementation
Microsoft::Terminal::Settings::Model::Theme Theme();
bool IsolatedMode();
bool AllowHeadless();
bool RequestsTrayIcon();
TerminalApp::TerminalWindow CreateNewWindow();

View File

@@ -46,6 +46,7 @@ namespace TerminalApp
// Selected settings to expose
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
Boolean IsolatedMode { get; };
Boolean AllowHeadless { get; };
Boolean RequestsTrayIcon { get; };
FindTargetWindowResult FindTargetWindow(String[] args);

View File

@@ -400,6 +400,9 @@
<data name="CmdSavedLayoutArgDesc" xml:space="preserve">
<value>This parameter is an internal implementation detail and should not be used.</value>
</data>
<data name="CmdHeadlessArgDesc" xml:space="preserve">
<value>Forces this launch of the Terminal into headless mode. If there are no other actions specified on the command line, then this will start the Terminal without a visible window. If the Terminal is already running, force the currently running terminal into headless mode. In headless mode, closing all terminal windows does not close this terminal instance, unless you perform the "Quit the Terminal" action.</value>
</data>
<data name="CmdWindowTargetArgDesc" xml:space="preserve">
<value>Specify a terminal window to run the given commandline in. "0" always refers to the current window. </value>
</data>

View File

@@ -99,6 +99,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
INHERITABLE_SETTING(Boolean, EnableColorSelection);
INHERITABLE_SETTING(Boolean, IsolatedMode);
INHERITABLE_SETTING(Boolean, AllowHeadless);
Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
void AddColorScheme(ColorScheme scheme);

View File

@@ -64,6 +64,7 @@ Author(s):
X(bool, TrimPaste, "trimPaste", true) \
X(bool, EnableColorSelection, "experimental.enableColorSelection", false) \
X(winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry>, NewTabMenu, "newTabMenu", winrt::single_threaded_vector<Model::NewTabMenuEntry>({ Model::RemainingProfilesEntry{} })) \
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
X(bool, IsolatedMode, "compatibility.isolatedMode", false)
#define MTSM_PROFILE_SETTINGS(X) \

View File

@@ -181,7 +181,19 @@ void WindowEmperor::_windowExitedHandler(uint64_t senderID)
return w->Peasant().GetID() == senderID;
});
if (lockedWindows->size() == 0)
// When we run out of windows, exit our process if and only if:
// * We're not allowed to run headless OR
// * we've explicitly been told to "quit", which should fully exit the Terminal.
const bool noMoreWindows{ lockedWindows->size() == 0 };
// We're not allowed to run headless:
//
const bool quitWhenLastWindowExits{
(!_app.Logic().AllowHeadless() && !_manager.HeadlessMode()) ||
_app.Logic().IsolatedMode()
};
if (noMoreWindows &&
(_quitting || quitWhenLastWindowExits))
{
_close();
}
@@ -276,6 +288,8 @@ void WindowEmperor::_numberOfWindowsChanged(const winrt::Windows::Foundation::II
void WindowEmperor::_quitAllRequested(const winrt::Windows::Foundation::IInspectable&,
const winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs& args)
{
_quitting = true;
// Make sure that the current timer is destroyed so that it doesn't attempt
// to run while we are in the middle of quitting.
if (_getWindowLayoutThrottler.has_value())

View File

@@ -51,6 +51,8 @@ private:
std::unique_ptr<NotificationIcon> _notificationIcon;
bool _quitting{ false };
void _windowStartedHandler(const std::shared_ptr<WindowThread>& sender);
void _windowExitedHandler(uint64_t senderID);