@@ -121,7 +121,11 @@ public static void OpenSelectedProjectWith()
121121 public static void OpenSelectedProjectInTerminal ( )
122122 {
123123 if ( TryGetSelectedProject ( out var unityProject ) )
124+ {
124125 OsUtils . OpenInTerminal ( unityProject . path ) ;
126+ if ( UnityHubNativeNetApp . Config . closeAfterOpenInTerminal )
127+ Instance . Close ( ) ;
128+ }
125129 }
126130
127131 public static void OnRemoveProjectFromListClicked ( )
@@ -396,7 +400,8 @@ public static void MoveSelectedProjectDown()
396400 Header = "Options" ,
397401 Content = new DockPanel
398402 {
399- LastChildFill = false
403+ LastChildFill = false ,
404+ Margin = new ( 10 ) ,
400405 } . AddChildren
401406 ( [
402407 new SettingsExpander
@@ -544,19 +549,42 @@ public static void MoveSelectedProjectDown()
544549 {
545550 Content = new DockPanel
546551 {
552+ LastChildFill = false
547553 } . AddChildren
548554 ( [
549- new TextBlock
555+ new DockPanel
550556 {
551- Text = "Format to open project in Terminal" ,
552- VerticalAlignment = VerticalAlignment . Center ,
553- Margin = new ( 0 , 0 , 10 , 0 ) ,
554- } . SetDock ( Dock . Left ) ,
555- s_openInTerminalFormatText = new TextBox
557+ } . AddChildren
558+ ( [
559+ new TextBlock
560+ {
561+ Text = "Format to open project in Terminal" ,
562+ VerticalAlignment = VerticalAlignment . Center ,
563+ Margin = new ( 0 , 0 , 10 , 0 ) ,
564+ } . SetDock ( Dock . Left ) ,
565+ s_openInTerminalFormatText = new TextBox
566+ {
567+ Text = UnityHubNativeNetApp . Config . openInTerminalFormat ,
568+ VerticalAlignment = VerticalAlignment . Center ,
569+ } . OnTextChanged ( OnOpenInTerminalFormatChanged ) . SetDock ( Dock . Right )
570+ ] ) . SetDock ( Dock . Top ) ,
571+ new DockPanel
556572 {
557- Text = UnityHubNativeNetApp . Config . openInTerminalFormat ,
558- VerticalAlignment = VerticalAlignment . Center ,
559- } . OnTextChanged ( OnOpenInTerminalFormatChanged ) . SetDock ( Dock . Right )
573+ LastChildFill = false
574+ } . AddChildren
575+ ( [
576+ new TextBlock
577+ {
578+ Text = "Close after open in terminal" ,
579+ VerticalAlignment = VerticalAlignment . Center ,
580+ Margin = new ( 0 , 0 , 10 , 0 ) ,
581+ } . SetDock ( Dock . Left ) ,
582+ new CheckBox
583+ {
584+ IsChecked = UnityHubNativeNetApp . Config . closeAfterOpenInTerminal ,
585+ VerticalAlignment = VerticalAlignment . Center ,
586+ } . OnCheckChanged ( OnCloseAfterOpenInTerminalChanged ) . SetDock ( Dock . Right )
587+ ] ) . SetDock ( Dock . Top ) . SetTooltip ( "Whether or not to close the app after opening project in terminal" ) ,
560588 ] )
561589 } . SetTooltip ( "Defines the process format of when opening a project in terminal. {path} will be replaced by the project path" ) ,
562590 ] )
@@ -566,6 +594,12 @@ public static void MoveSelectedProjectDown()
566594 ] )
567595 ] ) ;
568596
597+ static void OnCloseAfterOpenInTerminalChanged ( )
598+ {
599+ UnityHubNativeNetApp . Config . closeAfterOpenInTerminal = ! UnityHubNativeNetApp . Config . closeAfterOpenInTerminal ;
600+ UnityHubNativeNetApp . SaveConfig ( UnityHubNativeNetApp . Config ) ;
601+ }
602+
569603 static void OnOpenInTerminalFormatChanged ( )
570604 {
571605 UnityHubNativeNetApp . Config . openInTerminalFormat = s_openInTerminalFormatText . Text ;
0 commit comments