@@ -239,6 +239,14 @@ namespace winrt::TerminalApp::implementation
239
239
_newTabButton.Click ([weakThis{ get_weak () }](auto &&, auto &&) {
240
240
if (auto page{ weakThis.get () })
241
241
{
242
+ TraceLoggingWrite (
243
+ g_hTerminalAppProvider,
244
+ " NewTabMenuDefaultButtonClicked" ,
245
+ TraceLoggingDescription (" Event emitted when the default button from the new tab split button is invoked" ),
246
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
247
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
248
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
249
+
242
250
page->_OpenNewTerminalViaDropdown (NewTerminalArgs ());
243
251
}
244
252
});
@@ -880,14 +888,36 @@ namespace winrt::TerminalApp::implementation
880
888
// Since the previous focus location might be discarded in the background,
881
889
// e.g., the command palette will be dismissed by the menu,
882
890
// and then closing the fly-out will move the focus to wrong location.
883
- newTabFlyout.Opening ([this ](auto &&, auto &&) {
884
- _FocusCurrentTab (true );
891
+ newTabFlyout.Opening ([weakThis{ get_weak () }](auto &&, auto &&) {
892
+ if (auto page{ weakThis.get () })
893
+ {
894
+ page->_FocusCurrentTab (true );
895
+
896
+ TraceLoggingWrite (
897
+ g_hTerminalAppProvider,
898
+ " NewTabMenuOpened" ,
899
+ TraceLoggingDescription (" Event emitted when the new tab menu is opened" ),
900
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The Count of tabs currently opened in this window" ),
901
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
902
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
903
+ }
885
904
});
886
905
// Necessary for fly-out sub items to get focus on a tab before collapsing. Related to #15049
887
- newTabFlyout.Closing ([this ](auto &&, auto &&) {
888
- if (! _commandPaletteIs (Visibility::Visible) )
906
+ newTabFlyout.Closing ([weakThis{ get_weak () } ](auto &&, auto &&) {
907
+ if (auto page{ weakThis. get () } )
889
908
{
890
- _FocusCurrentTab (true );
909
+ if (!page->_commandPaletteIs (Visibility::Visible))
910
+ {
911
+ page->_FocusCurrentTab (true );
912
+ }
913
+
914
+ TraceLoggingWrite (
915
+ g_hTerminalAppProvider,
916
+ " NewTabMenuClosed" ,
917
+ TraceLoggingDescription (" Event emitted when the new tab menu is closed" ),
918
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The Count of tabs currently opened in this window" ),
919
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
920
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
891
921
}
892
922
});
893
923
_newTabButton.Flyout (newTabFlyout);
@@ -1092,6 +1122,15 @@ namespace winrt::TerminalApp::implementation
1092
1122
profileMenuItem.Click ([profileIndex, weakThis{ get_weak () }](auto &&, auto &&) {
1093
1123
if (auto page{ weakThis.get () })
1094
1124
{
1125
+ TraceLoggingWrite (
1126
+ g_hTerminalAppProvider,
1127
+ " NewTabMenuItemClicked" ,
1128
+ TraceLoggingDescription (" Event emitted when an item from the new tab menu is invoked" ),
1129
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
1130
+ TraceLoggingValue (" Profile" , " ItemType" , " The type of item that was clicked in the new tab menu" ),
1131
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1132
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1133
+
1095
1134
NewTerminalArgs newTerminalArgs{ profileIndex };
1096
1135
page->_OpenNewTerminalViaDropdown (newTerminalArgs);
1097
1136
}
@@ -1137,6 +1176,15 @@ namespace winrt::TerminalApp::implementation
1137
1176
actionMenuItem.Click ([action, weakThis{ get_weak () }](auto &&, auto &&) {
1138
1177
if (auto page{ weakThis.get () })
1139
1178
{
1179
+ TraceLoggingWrite (
1180
+ g_hTerminalAppProvider,
1181
+ " NewTabMenuItemClicked" ,
1182
+ TraceLoggingDescription (" Event emitted when an item from the new tab menu is invoked" ),
1183
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
1184
+ TraceLoggingValue (" Action" , " ItemType" , " The type of item that was clicked in the new tab menu" ),
1185
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1186
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1187
+
1140
1188
page->_actionDispatch ->DoAction (action.ActionAndArgs ());
1141
1189
}
1142
1190
});
@@ -1198,6 +1246,7 @@ namespace winrt::TerminalApp::implementation
1198
1246
1199
1247
const auto dispatchToElevatedWindow = ctrlPressed && !IsRunningElevated ();
1200
1248
1249
+ auto sessionType = " " ;
1201
1250
if ((shiftPressed || dispatchToElevatedWindow) && !debugTap)
1202
1251
{
1203
1252
// Manually fill in the evaluated profile.
@@ -1215,10 +1264,12 @@ namespace winrt::TerminalApp::implementation
1215
1264
if (dispatchToElevatedWindow)
1216
1265
{
1217
1266
_OpenElevatedWT (newTerminalArgs);
1267
+ sessionType = " ElevatedWindow" ;
1218
1268
}
1219
1269
else
1220
1270
{
1221
1271
_OpenNewWindow (newTerminalArgs);
1272
+ sessionType = " Window" ;
1222
1273
}
1223
1274
}
1224
1275
else
@@ -1237,12 +1288,23 @@ namespace winrt::TerminalApp::implementation
1237
1288
SplitDirection::Automatic,
1238
1289
0 .5f ,
1239
1290
newPane);
1291
+ sessionType = " Pane" ;
1240
1292
}
1241
1293
else
1242
1294
{
1243
1295
_CreateNewTabFromPane (newPane);
1296
+ sessionType = " Tab" ;
1244
1297
}
1245
1298
}
1299
+
1300
+ TraceLoggingWrite (
1301
+ g_hTerminalAppProvider,
1302
+ " NewTabMenuCreatedNewTerminalSession" ,
1303
+ TraceLoggingDescription (" Event emitted when a new terminal was created via the new tab menu" ),
1304
+ TraceLoggingValue (NumberOfTabs (), " NewTabCount" , " The count of tabs currently opened in this window" ),
1305
+ TraceLoggingValue (sessionType, " SessionType" , " The type of session that was created" ),
1306
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1307
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1246
1308
}
1247
1309
1248
1310
std::wstring TerminalPage::_evaluatePathForCwd (const std::wstring_view path)
@@ -1449,6 +1511,30 @@ namespace winrt::TerminalApp::implementation
1449
1511
{
1450
1512
target = SettingsTarget::DefaultsFile;
1451
1513
}
1514
+
1515
+ const auto targetAsString = [&target]() {
1516
+ switch (target)
1517
+ {
1518
+ case SettingsTarget::SettingsFile:
1519
+ return " SettingsFile" ;
1520
+ case SettingsTarget::DefaultsFile:
1521
+ return " DefaultsFile" ;
1522
+ case SettingsTarget::SettingsUI:
1523
+ default :
1524
+ return " UI" ;
1525
+ }
1526
+ }();
1527
+
1528
+ TraceLoggingWrite (
1529
+ g_hTerminalAppProvider,
1530
+ " NewTabMenuItemClicked" ,
1531
+ TraceLoggingDescription (" Event emitted when an item from the new tab menu is invoked" ),
1532
+ TraceLoggingValue (NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
1533
+ TraceLoggingValue (" Settings" , " ItemType" , " The type of item that was clicked in the new tab menu" ),
1534
+ TraceLoggingValue (targetAsString, " SettingsTarget" , " The target settings file or UI" ),
1535
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1536
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1537
+
1452
1538
_LaunchSettings (target);
1453
1539
}
1454
1540
@@ -1460,6 +1546,15 @@ namespace winrt::TerminalApp::implementation
1460
1546
auto p = LoadCommandPalette ();
1461
1547
p.EnableCommandPaletteMode (CommandPaletteLaunchMode::Action);
1462
1548
p.Visibility (Visibility::Visible);
1549
+
1550
+ TraceLoggingWrite (
1551
+ g_hTerminalAppProvider,
1552
+ " NewTabMenuItemClicked" ,
1553
+ TraceLoggingDescription (" Event emitted when an item from the new tab menu is invoked" ),
1554
+ TraceLoggingValue (NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
1555
+ TraceLoggingValue (" CommandPalette" , " ItemType" , " The type of item that was clicked in the new tab menu" ),
1556
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1557
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1463
1558
}
1464
1559
1465
1560
// Method Description:
@@ -1472,6 +1567,15 @@ namespace winrt::TerminalApp::implementation
1472
1567
const RoutedEventArgs&)
1473
1568
{
1474
1569
_ShowAboutDialog ();
1570
+
1571
+ TraceLoggingWrite (
1572
+ g_hTerminalAppProvider,
1573
+ " NewTabMenuItemClicked" ,
1574
+ TraceLoggingDescription (" Event emitted when an item from the new tab menu is invoked" ),
1575
+ TraceLoggingValue (NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
1576
+ TraceLoggingValue (" About" , " ItemType" , " The type of item that was clicked in the new tab menu" ),
1577
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
1578
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
1475
1579
}
1476
1580
1477
1581
// Method Description:
@@ -5381,6 +5485,14 @@ namespace winrt::TerminalApp::implementation
5381
5485
runAsAdminItem.Click ([profileIndex, weakThis{ get_weak () }](auto &&, auto &&) {
5382
5486
if (auto page{ weakThis.get () })
5383
5487
{
5488
+ TraceLoggingWrite (
5489
+ g_hTerminalAppProvider,
5490
+ " NewTabMenuItemElevateSubmenuItemClicked" ,
5491
+ TraceLoggingDescription (" Event emitted when the elevate submenu item from the new tab menu is invoked" ),
5492
+ TraceLoggingValue (page->NumberOfTabs (), " TabCount" , " The count of tabs currently opened in this window" ),
5493
+ TraceLoggingKeyword (MICROSOFT_KEYWORD_MEASURES),
5494
+ TelemetryPrivacyDataTag (PDT_ProductAndServiceUsage));
5495
+
5384
5496
NewTerminalArgs args{ profileIndex };
5385
5497
args.Elevate (true );
5386
5498
page->_OpenNewTerminalViaDropdown (args);
0 commit comments