Closed drewda closed 8 years ago
See matryer/bitbar#175
Thanks @iosdeveloper
In the short term, you can set iTerm to handle ssh://
URLs. You can then use open
.
From https://www.iterm2.com/faq.html :
Q: How do I set iTerm2 as the handler for ssh:// links?
A: Two steps:
Create a new profile called "ssh". In the General tab, select the Command: button and enter $$ as the command. In Preferences->Profiles->General, select "ssh" for "Select URL Schemes...."
So
print $2" | bash=ssh param1="$2
becomes
print $2" | bash=open param1=ssh://"$2" terminal=false"
.
With terminal=false, you need to invoke open with its absolute path.
bash=/usr/bin/open param1=ssh://"$2" terminal=false"
Hi,
This does not seems to work anymore. It first opens terminal and the Iterm
@freeyland please post your full script here
Please forget about it. Code for other people:
if [[ "$2" = "sshconnect" ]]; then
osascript - "ssh $1" <<EOF
on run argv
tell application "iTerm2"
tell current session of current window
split horizontally with default profile command argv
end tell
tell current session
set name to "Console"
end tell
end tell
end run
EOF
exit
fi
echo " SSH |"
echo "---"
function hosts() {
awk '
$1 == "Host" {
host = $2;
next;
}
$1 == "HostName" {
print host;
}
' "$1"
}
for h in $(hosts ~/.ssh/config); do
A="$(cut -d'/' -f2 <<<"${h}")"
B="$(cut -d'/' -f1 <<<"${h}")"
C="$(cut -d'/' -f3 <<<"${h}")"
if [[ "$C" != "" ]]; then
if [[ "$B" != "$prevB" ]]; then
echo "$B"
fi
if [[ "$A" != "$prevA" ]]; then
echo "-- $A"
fi
echo "---- $C | bash='$0' param1=${h} param2='sshconnect' param3='$C' terminal=false"
prevA=$A
prevB=$B
else
if [[ "$B" != "$prevB" ]]; then
echo "$B"
fi
echo "-- $A | bash='$0' param1=${h} param2='sshconnect' param3='$A' terminal=false"
prevA=$A
prevB=$B
fi
done
Using the SSH plug-in (https://getbitbar.com/plugins/Network/ssh.sh ) would it be possible to open sessions in iTerm2, rather than the default Mac terminal?
FAO: (@thameera)