/* private Task<string?> OpenFolderKDialog() { return RunKDialog("--getexistingdirectory"); } */ private async Task<string?> RunKDialog(params string[] options) { var startInfo = new ProcessStartInfo { FileName = "kdialog", RedirectStandardOutput = true, UseShellExecute = false, StandardOutputEncoding = EncodingHelpers.UTF8 }; foreach (var option in options) { startInfo.ArgumentList.Add(option); } if (_clyde.GetX11WindowId() is { } id) { startInfo.ArgumentList.Add("--attach"); startInfo.ArgumentList.Add(id.ToString()); } var process = Process.Start(startInfo); DebugTools.AssertNotNull(process); await process!.WaitForExitAsync(); // Cancel hit. if (process.ExitCode == 1) { return null; } return (await process.StandardOutput.ReadLineAsync())?.Trim(); }