mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
optimize<*>: remove Windows Terminal settings because it can be set outside in Windows Terminal
This commit is contained in:
parent
44ed55937d
commit
171f1d1d0c
5 changed files with 511 additions and 546 deletions
|
@ -68,11 +68,6 @@ namespace SourceGit.Models {
|
||||||
/// 上一次检测的时间(用于控制每天仅第一次启动软件时,检测)
|
/// 上一次检测的时间(用于控制每天仅第一次启动软件时,检测)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int LastCheckDay { get; set; } = 0;
|
public int LastCheckDay { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否尝试使用 Windows Terminal 打开终端
|
|
||||||
/// </summary>
|
|
||||||
public bool UseWindowsTerminal { get; set; } = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -166,13 +165,6 @@
|
||||||
Grid.Row="6" Grid.Column="1"
|
Grid.Row="6" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Preference.RestoreTabs}"
|
Content="{DynamicResource Text.Preference.RestoreTabs}"
|
||||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<!-- Use Windows Terminal -->
|
|
||||||
<CheckBox
|
|
||||||
Grid.Row="7" Grid.Column="1"
|
|
||||||
Content="{DynamicResource Text.Preference.UseWindowsTerminal}"
|
|
||||||
IsEnabled="{Binding ElementName=me, Path=HasWindowsTerminal}"
|
|
||||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseWindowsTerminal, Mode=TwoWay}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,9 @@ namespace SourceGit.Views {
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
public string CRLF { get; set; }
|
public string CRLF { get; set; }
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
public bool HasWindowsTerminal { get; set; }
|
|
||||||
|
|
||||||
public Preference() {
|
public Preference() {
|
||||||
UpdateGitInfo(false);
|
UpdateGitInfo(false);
|
||||||
|
|
||||||
HasWindowsTerminal = Models.ExecutableFinder.Find("wt.exe") != null;
|
|
||||||
if (!HasWindowsTerminal) Models.Preference.Instance.General.UseWindowsTerminal = false;
|
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,21 +320,12 @@ namespace SourceGit.Views.Widgets {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Models.Preference.Instance.General.UseWindowsTerminal) {
|
|
||||||
Process.Start(new ProcessStartInfo {
|
|
||||||
WorkingDirectory = repo.Path,
|
|
||||||
FileName = "wt",
|
|
||||||
Arguments = $"-d \"{repo.Path}\" \"{bash}\"",
|
|
||||||
UseShellExecute = false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Process.Start(new ProcessStartInfo {
|
Process.Start(new ProcessStartInfo {
|
||||||
WorkingDirectory = repo.Path,
|
WorkingDirectory = repo.Path,
|
||||||
FileName = bash,
|
FileName = bash,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenInVSCode(object sender, RoutedEventArgs e) {
|
private void OpenInVSCode(object sender, RoutedEventArgs e) {
|
||||||
var vscode = Models.ExecutableFinder.Find("code.cmd");
|
var vscode = Models.ExecutableFinder.Find("code.cmd");
|
||||||
|
|
|
@ -86,18 +86,10 @@ namespace SourceGit.Views.Widgets {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Models.Preference.Instance.General.UseWindowsTerminal) {
|
|
||||||
Process.Start(new ProcessStartInfo {
|
|
||||||
FileName = "wt",
|
|
||||||
Arguments = $"\"{bash}\"",
|
|
||||||
UseShellExecute = false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Process.Start(new ProcessStartInfo {
|
Process.Start(new ProcessStartInfo {
|
||||||
FileName = bash,
|
FileName = bash,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue