@@ -121,7 +121,11 @@ public static void OpenSelectedProjectWith()
121
121
public static void OpenSelectedProjectInTerminal ( )
122
122
{
123
123
if ( TryGetSelectedProject ( out var unityProject ) )
124
+ {
124
125
OsUtils . OpenInTerminal ( unityProject . path ) ;
126
+ if ( UnityHubNativeNetApp . Config . closeAfterOpenInTerminal )
127
+ Instance . Close ( ) ;
128
+ }
125
129
}
126
130
127
131
public static void OnRemoveProjectFromListClicked ( )
@@ -396,7 +400,8 @@ public static void MoveSelectedProjectDown()
396
400
Header = "Options" ,
397
401
Content = new DockPanel
398
402
{
399
- LastChildFill = false
403
+ LastChildFill = false ,
404
+ Margin = new ( 10 ) ,
400
405
} . AddChildren
401
406
( [
402
407
new SettingsExpander
@@ -544,19 +549,42 @@ public static void MoveSelectedProjectDown()
544
549
{
545
550
Content = new DockPanel
546
551
{
552
+ LastChildFill = false
547
553
} . AddChildren
548
554
( [
549
- new TextBlock
555
+ new DockPanel
550
556
{
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
556
572
{
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" ) ,
560
588
] )
561
589
} . SetTooltip ( "Defines the process format of when opening a project in terminal. {path} will be replaced by the project path" ) ,
562
590
] )
@@ -566,6 +594,12 @@ public static void MoveSelectedProjectDown()
566
594
] )
567
595
] ) ;
568
596
597
+ static void OnCloseAfterOpenInTerminalChanged ( )
598
+ {
599
+ UnityHubNativeNetApp . Config . closeAfterOpenInTerminal = ! UnityHubNativeNetApp . Config . closeAfterOpenInTerminal ;
600
+ UnityHubNativeNetApp . SaveConfig ( UnityHubNativeNetApp . Config ) ;
601
+ }
602
+
569
603
static void OnOpenInTerminalFormatChanged ( )
570
604
{
571
605
UnityHubNativeNetApp . Config . openInTerminalFormat = s_openInTerminalFormatText . Text ;
0 commit comments