ux: Link found terminals to the UI

This commit is contained in:
walterlv 2024-04-08 19:10:30 +08:00
parent 41f7aa84ac
commit 467a39b2e9
9 changed files with 28 additions and 16 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Collections;
@ -15,6 +16,8 @@ using Avalonia.Platform;
using Avalonia.Platform.Storage;
using Avalonia.Threading;
using SourceGit.Native;
namespace SourceGit.Views
{
public partial class Preference : Window
@ -31,6 +34,12 @@ namespace SourceGit.Views
private set;
}
public AvaloniaList<string> ExternalTerminals
{
get;
private set;
}
public string DefaultUser
{
get;
@ -119,6 +128,8 @@ namespace SourceGit.Views
Dispatcher.UIThread.Post(() => InstalledMonospaceFonts.AddRange(sysMonoFonts));
});
ExternalTerminals = [..OS.ExternalTerminals.Select(x => x.Name)];
var ver = string.Empty;
if (pref.IsGitConfigured)
{
@ -271,7 +282,7 @@ namespace SourceGit.Views
{
if (value is string terminalName && !string.IsNullOrWhiteSpace(terminalName))
{
var name = App.Text($"Text.Preference.General.DefaultTerminalOrShell.{terminalName}");
var name = App.Text($"Preference.General.DefaultTerminalOrShell.{terminalName}");
return name;
}