Fix du5t auto-connect: spawn locally first, add SSH tab after a delay
Setting domain = { DomainName = "du5t" } directly in gui-startup's
spawn_window failed with "domain name du5t is invalid" -- at the
moment gui-startup fires, WezTerm hasn't finished registering
ssh_domains into the mux yet, so the very first spawn always races
against domain registration regardless of restarting the app.
Now the initial window spawns on the local domain as before (always
available), and half a second later a new tab is spawned against the
du5t domain and activated -- by then domain registration should be
complete. The local tab remains as tab 1, a safety net if the SSH
connection fails for any reason.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
14
wezterm.lua
14
wezterm.lua
@@ -751,11 +751,17 @@ end)
|
|||||||
|
|
||||||
-- 시작 시 첫 화면으로 메인 메뉴를 띄워 설정과 연결 메뉴에 바로 접근합니다.
|
-- 시작 시 첫 화면으로 메인 메뉴를 띄워 설정과 연결 메뉴에 바로 접근합니다.
|
||||||
wezterm.on("gui-startup", function(cmd)
|
wezterm.on("gui-startup", function(cmd)
|
||||||
local args = cmd or {}
|
-- gui-startup 시점엔 아직 SSH 도메인이 mux에 등록되기 전이라, 스폰 시 domain을 바로
|
||||||
args.domain = { DomainName = "du5t" } -- 시작 시 로컬 셸(cmd) 대신 du5t SSH 도메인으로 바로 연결
|
-- "du5t"로 지정하면 "domain name is invalid" 에러가 난다. 일단 로컬 셸로 창을 띄운 뒤
|
||||||
local tab, pane, window = wezterm.mux.spawn_window(args)
|
-- 잠깐 기다렸다가 du5t 탭을 새로 열어 그 탭을 활성화하는 방식으로 우회한다
|
||||||
|
local tab, pane, window = wezterm.mux.spawn_window(cmd or {})
|
||||||
|
local gui_window = window:gui_window()
|
||||||
list_system_fonts() -- 폰트 목록을 미리 캐싱해서, 나중에 폰트 설정 메뉴에서 조회 지연으로 화면이 깜빡이지 않게 함
|
list_system_fonts() -- 폰트 목록을 미리 캐싱해서, 나중에 폰트 설정 메뉴에서 조회 지연으로 화면이 깜빡이지 않게 함
|
||||||
show_main_menu(window:gui_window(), pane)
|
show_main_menu(gui_window, pane)
|
||||||
|
|
||||||
|
wezterm.time.call_after(0.5, function()
|
||||||
|
gui_window:perform_action(act.SpawnTab({ DomainName = "du5t" }), pane)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- 시작 시 자동으로 워크스페이스/레이아웃을 구성하려면 아래 예시를 참고하세요.
|
-- 시작 시 자동으로 워크스페이스/레이아웃을 구성하려면 아래 예시를 참고하세요.
|
||||||
|
|||||||
Reference in New Issue
Block a user