Fix SSH auto-connect spawning duplicate tabs on first attach
SpawnTab on a not-yet-attached SSH domain implicitly attaches it, which spawns a default tab, then the explicit SpawnTab adds another, resulting in two du5t tabs. Use AttachDomain instead, which attaches and ensures a single tab without duplicating it.
This commit is contained in:
@@ -105,7 +105,10 @@ wezterm.on("update-right-status", function(window, pane)
|
||||
startup_ssh_connect_tried = true
|
||||
local first_domain = config.ssh_domains and config.ssh_domains[1]
|
||||
if first_domain then
|
||||
window:perform_action(act.SpawnTab({ DomainName = first_domain.name }), pane)
|
||||
-- 아직 attach 안 된 도메인에 SpawnTab을 쓰면 "암묵적 attach가 만드는 기본 탭" +
|
||||
-- "명시적으로 요청한 탭"이 겹쳐서 탭이 2개 생긴다. AttachDomain은 attach와 동시에
|
||||
-- 탭이 없을 때만 하나 만들어주므로 중복이 없다.
|
||||
window:perform_action(act.AttachDomain(first_domain.name), pane)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -749,7 +752,8 @@ local function show_main_menu(window, pane)
|
||||
|
||||
local domain_name = id:match("^domain:(.+)$")
|
||||
if domain_name then
|
||||
inner_window:perform_action(act.SpawnTab({ DomainName = domain_name }), inner_pane)
|
||||
-- SpawnTab 대신 AttachDomain 사용 이유는 update-right-status 훅 근처 주석 참고
|
||||
inner_window:perform_action(act.AttachDomain(domain_name), inner_pane)
|
||||
elseif id == "settings" then
|
||||
show_settings_menu(inner_window, inner_pane)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user