diff --git a/wezterm.lua b/wezterm.lua index 6a7fab5..ff93e13 100644 --- a/wezterm.lua +++ b/wezterm.lua @@ -368,10 +368,10 @@ local function show_other_settings(window, pane) ) end -local function show_main_menu(window, pane) +local function show_settings_menu(window, pane) window:perform_action( act.InputSelector({ - title = "메인 메뉴", + title = "설정", fuzzy = true, choices = { { label = "폰트 설정", id = "font" }, @@ -405,6 +405,41 @@ local function show_main_menu(window, pane) ) end +-- 메인 메뉴: 등록된 SSH 연결들을 맨 위에, 설정 항목은 맨 아래에 배치 +local function show_main_menu(window, pane) + local choices = {} + + for _, domain in ipairs(config.ssh_domains or {}) do + table.insert(choices, { + label = domain.name .. " (" .. domain.remote_address .. ")", + id = "domain:" .. domain.name, + }) + end + + table.insert(choices, { label = "설정", id = "settings" }) + + window:perform_action( + act.InputSelector({ + title = "메인 메뉴", + fuzzy = true, + choices = choices, + action = wezterm.action_callback(function(inner_window, inner_pane, id) + if not id then + return + end + + local domain_name = id:match("^domain:(.+)$") + if domain_name then + inner_window:perform_action(act.SpawnTab({ DomainName = domain_name }), inner_pane) + elseif id == "settings" then + show_settings_menu(inner_window, inner_pane) + end + end), + }), + pane + ) +end + wezterm.on("show-main-menu", function(window, pane) show_main_menu(window, pane) end)