diff --git a/UotanToolbox/MainView.axaml.cs b/UotanToolbox/MainView.axaml.cs index ca67e836..0c885449 100644 --- a/UotanToolbox/MainView.axaml.cs +++ b/UotanToolbox/MainView.axaml.cs @@ -41,25 +41,54 @@ private void InputElement_OnPointerPressed(object sender, PointerPressedEventArg private void OpenTerminal(object sender, RoutedEventArgs e) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { Process.Start(new ProcessStartInfo { FileName = "cmd.exe", WorkingDirectory = Path.Combine(Global.bin_path, "platform-tools"), UseShellExecute = true }); + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - try + { + string[] terminalCommands = new string[] + { + "x-terminal-emulator", // Generic terminal emulator + "gnome-terminal", // GNOME terminal + "deepin-terminal", // deepin terminal + "konsole", // KDE Konsole + "xfce4-terminal", // XFCE terminal + "mate-terminal", // MATE terminal + "lxterminal", // LXDE terminal + "tilix", // Tilix terminal + "alacritty", // Alacritty terminal + "xterm", // Xterm as fallback + "kitty", // Kitty terminal + "wezterm" // Wezterm terminal + }; + + foreach (var terminal in terminalCommands) { - Process.Start(new ProcessStartInfo + try + { + Process.Start(new ProcessStartInfo + { + FileName = terminal, + Arguments = $"--working-directory={Path.Combine(Global.bin_path, "platform-tools", "adb")}", + UseShellExecute = false + }); + break; // If successful, break out of the loop + } + catch { - FileName = "/usr/bin/gnome-terminal", - Arguments = $"--working-directory={Path.Combine(Global.bin_path, "platform-tools", "adb")}", - UseShellExecute = false - }); + // Continue trying other terminals if one fails + } } - catch { } + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { Process.Start("open", "-a Terminal " + Path.Combine(Global.bin_path, "platform-tools", "adb")); + } } private void InitializeComponent() @@ -72,4 +101,4 @@ private void InitializeComponent() Settings.Default.Save(); }; } -} \ No newline at end of file +}