@@ -106,7 +106,10 @@ namespace winrt::TerminalApp::implementation
106106 }
107107 _hostingHwnd = hwnd;
108108
109- _tmuxControl = std::make_unique<TmuxControl>(*this );
109+ if constexpr (Feature_TmuxControl::IsEnabled ())
110+ {
111+ _tmuxControl = std::make_unique<TmuxControl>(*this );
112+ }
110113 return S_OK;
111114 }
112115
@@ -241,6 +244,15 @@ namespace winrt::TerminalApp::implementation
241244 _newTabButton.Click ([weakThis{ get_weak () }](auto &&, auto &&) {
242245 if (auto page{ weakThis.get () })
243246 {
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+
244256 page->_OpenNewTerminalViaDropdown (NewTerminalArgs ());
245257 }
246258 });
@@ -1206,6 +1218,15 @@ namespace winrt::TerminalApp::implementation
12061218 }
12071219 if (altPressed && !debugTap)
12081220 {
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+
12091230 this ->_SplitPane (_GetFocusedTabImpl (),
12101231 SplitDirection::Automatic,
12111232 0 .5f ,
@@ -2244,6 +2265,15 @@ namespace winrt::TerminalApp::implementation
22442265 return false ;
22452266 }
22462267
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+
22472277 // If there was a windowId in the action, try to move it to the
22482278 // specified window instead of moving it in our tab row.
22492279 const auto windowId{ args.Window () };
@@ -2306,7 +2336,7 @@ namespace winrt::TerminalApp::implementation
23062336 // for it. The Title change will be propagated upwards through the tab's
23072337 // PropertyChanged event handler.
23082338 void TerminalPage::_activePaneChanged (winrt::TerminalApp::TerminalTab sender,
2309- Windows::Foundation::IInspectable args)
2339+ Windows::Foundation::IInspectable /* args*/ )
23102340 {
23112341 if (const auto tab{ _GetTerminalTabImpl (sender) })
23122342 {
@@ -3191,7 +3221,7 @@ namespace winrt::TerminalApp::implementation
31913221 const auto tabViewItem = eventArgs.Tab ();
31923222 if (auto tab{ _GetTabByTabViewItem (tabViewItem) })
31933223 {
3194- _HandleCloseTabRequested ( tab);
3224+ tab. try_as <TabBase>()-> CloseRequested . raise ( nullptr , nullptr );
31953225 }
31963226 }
31973227
@@ -3357,9 +3387,16 @@ namespace winrt::TerminalApp::implementation
33573387 resultPane->ClearActive ();
33583388 original->SetActive ();
33593389 }
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+ }
33633400
33643401 return resultPane;
33653402 }
@@ -5241,6 +5278,14 @@ namespace winrt::TerminalApp::implementation
52415278 void TerminalPage::_onTabDragStarting (const winrt::Microsoft::UI::Xaml::Controls::TabView&,
52425279 const winrt::Microsoft::UI::Xaml::Controls::TabViewTabDragStartingEventArgs& e)
52435280 {
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+ }
52445289 // Get the tab impl from this event.
52455290 const auto eventTab = e.Tab ();
52465291 const auto tabBase = _GetTabByTabViewItem (eventTab);
@@ -5388,8 +5433,8 @@ namespace winrt::TerminalApp::implementation
53885433 _sendDraggedTabToWindow (winrt::to_hstring (args.TargetWindow ()), args.TabIndex (), std::nullopt );
53895434 }
53905435
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 */ )
53935438 {
53945439 // Get the current pointer point from the CoreWindow
53955440 const auto & pointerPoint{ CoreWindow::GetForCurrentThread ().PointerPosition () };
0 commit comments