Repository: microsoft/terminal (language: cpp)

Issue:
DefTerm By Default needs buy-in from Terminal Stable
The way we set up "terminal is the default terminal", it gets started as the handoff target with _no GUIDs in the registry._ Either we need to write them to the registry on startup as a bugfix in Windows, or we need to continue the "deceit" into the Terminal itself. 

This includes:

1. Showing Terminal as the default on applicable Windows versions (!)
   * this will be annoying if we back the feature out
2. Handing off to Terminal Stable even if the check in stubs.cpp says not to, if we received a handoff

Perhaps the "simple" fix is to make OpenConsole always hand off to its packaged terminal (hardcode more GUIDs) if it received a handoff itself.

This may need to block 1.12.


Discussion / hints:

Fix patch:
diff --git a/src/internal/stubs.cpp b/src/internal/stubs.cpp
index da6423d14ec..5a047da742e 100644
--- a/src/internal/stubs.cpp
+++ b/src/internal/stubs.cpp
@@ -40,9 +40,16 @@ void EdpPolicy::AuditClipboard(const std::wstring_view /*destinationName*/) noex
 
 [[nodiscard]] HRESULT DefaultApp::CheckShouldTerminalBeDefault(bool& isEnabled) noexcept
 {
-    // False since setting Terminal as the default app is an OS feature and probably
-    // should not be done in the open source conhost. We can always decide to turn it
-    // on in the future though.
-    isEnabled = false;
+    // Since we toggled this feature on in Windows, Terminal (and Terminal Preview) need to
+    // agree -- otherwise, they will present UI that suggests Terminal is NOT the default,
+    // like the info bar.
+    OSVERSIONINFOEXW osver{};
+    osver.dwOSVersionInfoSize = sizeof(osver);
+    osver.dwBuildNumber = 22544;
+
+    DWORDLONG dwlConditionMask = 0;
+    VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
+
+    isEnabled = VerifyVersionInfoW(&osver, VER_BUILDNUMBER, dwlConditionMask) != FALSE;
     return S_OK;
 }


Test patch: