forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellOrTerminal.cs
More file actions
78 lines (72 loc) · 3.05 KB
/
ShellOrTerminal.cs
File metadata and controls
78 lines (72 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
namespace SourceGit.Models
{
public class ShellOrTerminal
{
public string Type { get; set; }
public string Name { get; set; }
public string Exec { get; set; }
public string Args { get; set; }
public Bitmap Icon
{
get
{
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/ShellIcons/{Type}.png", UriKind.RelativeOrAbsolute));
return new Bitmap(icon);
}
}
public static readonly List<ShellOrTerminal> Supported;
static ShellOrTerminal()
{
if (OperatingSystem.IsWindows())
{
Supported = new List<ShellOrTerminal>()
{
new ShellOrTerminal("git-bash", "Git Bash", "bash.exe"),
new ShellOrTerminal("pwsh", "PowerShell", "pwsh.exe|powershell.exe"),
new ShellOrTerminal("cmd", "Command Prompt", "cmd.exe"),
new ShellOrTerminal("wt", "Windows Terminal", "wt.exe", "-d .")
};
}
else if (OperatingSystem.IsMacOS())
{
Supported = new List<ShellOrTerminal>()
{
new ShellOrTerminal("mac-terminal", "Terminal", "Terminal"),
new ShellOrTerminal("iterm2", "iTerm", "iTerm"),
new ShellOrTerminal("warp", "Warp", "Warp"),
new ShellOrTerminal("ghostty", "Ghostty", "Ghostty"),
new ShellOrTerminal("kitty", "kitty", "kitty")
};
}
else
{
Supported = new List<ShellOrTerminal>()
{
new ShellOrTerminal("gnome-terminal", "Gnome Terminal", "gnome-terminal"),
new ShellOrTerminal("konsole", "Konsole", "konsole"),
new ShellOrTerminal("xfce4-terminal", "Xfce4 Terminal", "xfce4-terminal"),
new ShellOrTerminal("lxterminal", "LXTerminal", "lxterminal"),
new ShellOrTerminal("deepin-terminal", "Deepin Terminal", "deepin-terminal"),
new ShellOrTerminal("mate-terminal", "MATE Terminal", "mate-terminal"),
new ShellOrTerminal("foot", "Foot", "foot"),
new ShellOrTerminal("wezterm", "WezTerm", "wezterm", "start --cwd ."),
new ShellOrTerminal("ptyxis", "Ptyxis", "ptyxis", "--new-window --working-directory=."),
new ShellOrTerminal("ghostty", "Ghostty", "ghostty"),
new ShellOrTerminal("kitty", "kitty", "kitty"),
new ShellOrTerminal("custom", "Custom", ""),
};
}
}
public ShellOrTerminal(string type, string name, string exec, string args = null)
{
Type = type;
Name = name;
Exec = exec;
Args = args;
}
}
}