Restructure main menu: connections on top, settings at the bottom
Main menu now lists each registered config.ssh_domains entry as a choice (selecting one spawns a tab attached to that SSH domain via SpawnTab), with a single "설정" entry below them that opens what used to be the main menu (font/connection/other settings, launcher, reload) -- renamed to show_settings_menu. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
39
wezterm.lua
39
wezterm.lua
@@ -368,10 +368,10 @@ local function show_other_settings(window, pane)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_main_menu(window, pane)
|
local function show_settings_menu(window, pane)
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.InputSelector({
|
act.InputSelector({
|
||||||
title = "메인 메뉴",
|
title = "설정",
|
||||||
fuzzy = true,
|
fuzzy = true,
|
||||||
choices = {
|
choices = {
|
||||||
{ label = "폰트 설정", id = "font" },
|
{ label = "폰트 설정", id = "font" },
|
||||||
@@ -405,6 +405,41 @@ local function show_main_menu(window, pane)
|
|||||||
)
|
)
|
||||||
end
|
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)
|
wezterm.on("show-main-menu", function(window, pane)
|
||||||
show_main_menu(window, pane)
|
show_main_menu(window, pane)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user