@@ -106,7 +106,10 @@ namespace winrt::TerminalApp::implementation
106
106
}
107
107
_hostingHwnd = hwnd;
108
108
109
- _tmuxControl = std::make_unique<TmuxControl>(*this );
109
+ if constexpr (Feature_TmuxControl::IsEnabled ())
110
+ {
111
+ _tmuxControl = std::make_unique<TmuxControl>(*this );
112
+ }
110
113
return S_OK;
111
114
}
112
115
@@ -241,6 +244,15 @@ namespace winrt::TerminalApp::implementation
241
244
_newTabButton.Click ([weakThis{ get_weak () }](auto &&, auto &&) {
242
245
if (auto page{ weakThis.get () })
243
246
{
247
+ if constexpr (Feature_TmuxControl::IsEnabled ())
248
+ {
249
+ // Tmux control takes over
250
+ if (page->_tmuxControl && page->_tmuxControl ->ActiveTabIsTmuxControl ())
251
+ {
252
+ return ;
253
+ }
254
+ }
255
+
244
256
page->_OpenNewTerminalViaDropdown (NewTerminalArgs ());
245
257
}
246
258
});
@@ -1206,6 +1218,15 @@ namespace winrt::TerminalApp::implementation
1206
1218
}
1207
1219
if (altPressed && !debugTap)
1208
1220
{
1221
+ // tmux control panes don't share tab with other panes
1222
+ if constexpr (Feature_TmuxControl::IsEnabled ())
1223
+ {
1224
+ if (_tmuxControl && _tmuxControl->ActiveTabIsTmuxControl ())
1225
+ {
1226
+ return ;
1227
+ }
1228
+ }
1229
+
1209
1230
this ->_SplitPane (_GetFocusedTabImpl (),
1210
1231
SplitDirection::Automatic,
1211
1232
0 .5f ,
@@ -2244,6 +2265,15 @@ namespace winrt::TerminalApp::implementation
2244
2265
return false ;
2245
2266
}
2246
2267
2268
+ if constexpr (Feature_TmuxControl::IsEnabled ())
2269
+ {
2270
+ // Tmux control tab doesn't support to drag
2271
+ if (_tmuxControl && _tmuxControl->ActiveTabIsTmuxControl ())
2272
+ {
2273
+ return false ;
2274
+ }
2275
+ }
2276
+
2247
2277
// If there was a windowId in the action, try to move it to the
2248
2278
// specified window instead of moving it in our tab row.
2249
2279
const auto windowId{ args.Window () };
@@ -2306,7 +2336,7 @@ namespace winrt::TerminalApp::implementation
2306
2336
// for it. The Title change will be propagated upwards through the tab's
2307
2337
// PropertyChanged event handler.
2308
2338
void TerminalPage::_activePaneChanged (winrt::TerminalApp::TerminalTab sender,
2309
- Windows::Foundation::IInspectable args)
2339
+ Windows::Foundation::IInspectable /* args*/ )
2310
2340
{
2311
2341
if (const auto tab{ _GetTerminalTabImpl (sender) })
2312
2342
{
@@ -3191,7 +3221,7 @@ namespace winrt::TerminalApp::implementation
3191
3221
const auto tabViewItem = eventArgs.Tab ();
3192
3222
if (auto tab{ _GetTabByTabViewItem (tabViewItem) })
3193
3223
{
3194
- _HandleCloseTabRequested ( tab);
3224
+ tab. try_as <TabBase>()-> CloseRequested . raise ( nullptr , nullptr );
3195
3225
}
3196
3226
}
3197
3227
@@ -3357,9 +3387,16 @@ namespace winrt::TerminalApp::implementation
3357
3387
resultPane->ClearActive ();
3358
3388
original->SetActive ();
3359
3389
}
3360
- control.SetTmuxControlHandlerProducer ([this , control](auto print) {
3361
- return _tmuxControl->TmuxControlHandlerProducer (control, print);
3362
- });
3390
+
3391
+ if constexpr (Feature_TmuxControl::IsEnabled ())
3392
+ {
3393
+ if (profile.AllowTmuxControl () && _tmuxControl)
3394
+ {
3395
+ control.SetTmuxControlHandlerProducer ([this , control](auto print) {
3396
+ return _tmuxControl->TmuxControlHandlerProducer (control, print);
3397
+ });
3398
+ }
3399
+ }
3363
3400
3364
3401
return resultPane;
3365
3402
}
@@ -5241,6 +5278,14 @@ namespace winrt::TerminalApp::implementation
5241
5278
void TerminalPage::_onTabDragStarting (const winrt::Microsoft::UI::Xaml::Controls::TabView&,
5242
5279
const winrt::Microsoft::UI::Xaml::Controls::TabViewTabDragStartingEventArgs& e)
5243
5280
{
5281
+ if constexpr (Feature_TmuxControl::IsEnabled ())
5282
+ {
5283
+ // Tmux control tab doesn't support to drag
5284
+ if (_tmuxControl && _tmuxControl->ActiveTabIsTmuxControl ())
5285
+ {
5286
+ return ;
5287
+ }
5288
+ }
5244
5289
// Get the tab impl from this event.
5245
5290
const auto eventTab = e.Tab ();
5246
5291
const auto tabBase = _GetTabByTabViewItem (eventTab);
@@ -5388,8 +5433,8 @@ namespace winrt::TerminalApp::implementation
5388
5433
_sendDraggedTabToWindow (winrt::to_hstring (args.TargetWindow ()), args.TabIndex (), std::nullopt);
5389
5434
}
5390
5435
5391
- void TerminalPage::_onTabDroppedOutside (winrt::IInspectable sender,
5392
- winrt::MUX::Controls::TabViewTabDroppedOutsideEventArgs e )
5436
+ void TerminalPage::_onTabDroppedOutside (winrt::IInspectable /* sender*/ ,
5437
+ winrt::MUX::Controls::TabViewTabDroppedOutsideEventArgs /* e */ )
5393
5438
{
5394
5439
// Get the current pointer point from the CoreWindow
5395
5440
const auto & pointerPoint{ CoreWindow::GetForCurrentThread ().PointerPosition () };
0 commit comments