From 5b61bc37c2dab1de2325d09d860409c5a97b23c7 Mon Sep 17 00:00:00 2001 From: thuanle Date: Sat, 25 Jul 2026 03:16:23 +0700 Subject: [PATCH] Add ssh-open: open iTerm2 window with 6 SSH tabs Opens a new iTerm2 window with tabs that ssh into ta, vrc, aws-vanhoa, toc, oc, tk in order. Tab colors are applied by the ssh() override in ~/.zshrc (per-host); a small delay between tab creations lets iTerm process the color OSC reliably. Co-Authored-By: Claude --- ssh-open | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 ssh-open diff --git a/ssh-open b/ssh-open new file mode 100755 index 0000000..6725691 --- /dev/null +++ b/ssh-open @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# ssh-open — mở cửa sổ iTerm2 mới với 6 tab, mỗi tab ssh vào 1 host theo thứ tự. +# Màu tab do ~/.zshrc (hàm ssh() override) tự set khi ssh chạy trong tab. +# delay giữa các tab để iTerm kịp xử lý OSC đổi màu (tránh mất màu khi tạo tab liên tục). +set -euo pipefail + +# Danh sách host theo thứ tự (alias từ ~/.ssh/config). +HOSTS=(ta vrc aws-vanhoa toc oc tk) + +# Sinh AppleScript list: {"ta","vrc",...} +alist="$(printf '"%s",' "${HOSTS[@]}")" +alist="{${alist%,}}" + +osascript <