From df38de097b06da834445e076adf048329c66bb1b Mon Sep 17 00:00:00 2001 From: gm Date: Thu, 16 Jul 2026 18:36:44 +0900 Subject: [PATCH] Add main settings menu --- wezterm.lua | 66 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/wezterm.lua b/wezterm.lua index 4c16435..797b5b4 100644 --- a/wezterm.lua +++ b/wezterm.lua @@ -138,13 +138,66 @@ config.unix_domains = { { name = "unix" }, } --- 시작 시 첫 화면으로 통합 런처를 띄워 탭/도메인/워크스페이스/저장 세션을 바로 선택합니다. -wezterm.on("gui-startup", function(cmd) - local tab, pane, window = wezterm.mux.spawn_window(cmd or {}) - window:gui_window():perform_action( - act.ShowLauncherArgs({ flags = "FUZZY|TABS|DOMAINS|WORKSPACES|LAUNCH_MENU_ITEMS" }), +local config_file = "/mnt/storage/wezterm.lua" + +local function open_config_section(window, pane, line) + window:perform_action( + act.SpawnCommandInNewTab({ + args = { + "sh", + "-lc", + string.format('editor="${EDITOR:-vi}"; exec "$editor" +%d %q', line, config_file), + }, + }), pane ) +end + +local function show_main_menu(window, pane) + window:perform_action( + act.InputSelector({ + title = "메인 메뉴", + fuzzy = true, + choices = { + { label = "폰트 설정", id = "font" }, + { label = "연결 설정", id = "connection" }, + { label = "기타 설정", id = "other" }, + { label = "통합 런처", id = "launcher" }, + { label = "설정 다시 불러오기", id = "reload" }, + }, + action = wezterm.action_callback(function(inner_window, inner_pane, id) + if not id then + return + end + + if id == "font" then + open_config_section(inner_window, inner_pane, 6) + elseif id == "connection" then + open_config_section(inner_window, inner_pane, 123) + elseif id == "other" then + open_config_section(inner_window, inner_pane, 339) + elseif id == "launcher" then + inner_window:perform_action( + act.ShowLauncherArgs({ flags = "FUZZY|TABS|DOMAINS|WORKSPACES|LAUNCH_MENU_ITEMS" }), + inner_pane + ) + elseif id == "reload" then + inner_window:perform_action(act.ReloadConfiguration, inner_pane) + end + end), + }), + pane + ) +end + +wezterm.on("show-main-menu", function(window, pane) + show_main_menu(window, pane) +end) + +-- 시작 시 첫 화면으로 메인 메뉴를 띄워 설정과 연결 메뉴에 바로 접근합니다. +wezterm.on("gui-startup", function(cmd) + local tab, pane, window = wezterm.mux.spawn_window(cmd or {}) + show_main_menu(window:gui_window(), pane) end) -- 시작 시 자동으로 워크스페이스/레이아웃을 구성하려면 아래 예시를 참고하세요. @@ -192,6 +245,9 @@ config.keys = { { key = "c", mods = "CTRL|SHIFT", action = act.CopyTo("Clipboard") }, { key = "v", mods = "CTRL|SHIFT", action = act.PasteFrom("Clipboard") }, + -- 메인 메뉴: 설정 메뉴와 통합 런처를 다시 표시 + { key = "m", mods = "LEADER", action = act.EmitEvent("show-main-menu") }, + -- [2] 워크스페이스(=tmux 세션) 전환/생성 목록 { key = "w", mods = "LEADER", action = act.ShowLauncherArgs({ flags = "WORKSPACES" }) }, -- [2] SSH 도메인 접속 (config.ssh_domains에 등록한 서버 목록에서 선택)