Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

[Mac] Use NSAppleScript instead of Carbon to spawn the terminal process #6215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions main/src/addins/MacPlatform/MacExternalConsoleProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ internal static Task<int> RunTerminal (
appleScript = string.Format ("tell app \"{0}\" to do script \"bash -c '{1}'; exit\"", TERMINAL_APP, Escape (sb.ToString ()));
}
var ret = AppleScript.Run (appleScript);
int i = ret.IndexOf ("of", StringComparison.Ordinal);
tabId = ret.Substring (0, i -1);
windowId = ret.Substring (i + 3);
tabId = $"tab {ret ["indx"]}";
windowId = $"window id {ret ["ID "]}";

//rename tab and give it focus
sb.Clear ();
Expand Down Expand Up @@ -209,11 +208,6 @@ set frontmost of {1} to true
}
}

static bool TabExists (string tabId, string windowId)
{
return AppleScript.Run ("tell app \"{0}\" to get exists of {1} of {2}", TERMINAL_APP, tabId, windowId) == "true";
}

#endregion

#region IAsyncOperation implementation
Expand Down
Loading