Here is a simple translation of your code to use Applescript to perform the task, as explained in the proposed duplicate Running a command in a new Mac OS X Terminal window
if ($noexec) {
system(qq{echo osascript -e 'tell application "Terminal" to do script "ssh $url \& "'});
} else {
system(qq{osascript -e 'tell application "Terminal" to do script "ssh $url \& "'});
}
Running the ssh
command in the background seems like a very odd thing to do. Probably you should replace \&
with ; exit
.
I'm not sure what the mintty
options mean (I guess set the geometry to 160x40 and pick a particular cursor?) so I haven't attempted to implement those. https://superuser.com/questions/1188772/mac-command-to-change-the-background-color-in-a-terminal shows how to set the background color in Terminal via Applescript, for example.
If mintty
or Windows ssh
really accepts a URL to connect to (something like ssh://username@hostname
perhaps?) you will have to pick it apart and extract only the parameters which are acceptable to U*x ssh
(like username@hostname
without the ssh://
protocol specifier).