From c9be88c1b6ac914c8439963e6fab4de9f6dc6cc0 Mon Sep 17 00:00:00 2001 From: muon Date: Sun, 8 Mar 2026 15:55:01 +0000 Subject: [PATCH] Fix ud and ssh --- modules/home/terminal/wezterm.nix | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/modules/home/terminal/wezterm.nix b/modules/home/terminal/wezterm.nix index 655b5d4..8ec3555 100644 --- a/modules/home/terminal/wezterm.nix +++ b/modules/home/terminal/wezterm.nix @@ -207,6 +207,18 @@ in { end) end + -- scroll_or_passthrough: Ctrl+key scrolls at the shell prompt but passes + -- the key through when a program has taken the alt screen (vim, less, fzf…). + local function scroll_or_passthrough(key, pages) + return wezterm.action_callback(function(window, pane) + if pane:is_alt_screen_active() then + window:perform_action(act.SendKey({ key = key, mods = "CTRL" }), pane) + else + window:perform_action(act.ScrollByPage(pages), pane) + end + end) + end + -- tab_is_zoomed: true if any pane in the current tab is zoomed. -- Used by move_vertical to decide whether to carry zoom forward. local function tab_is_zoomed(pane) @@ -382,6 +394,16 @@ in { } config.tab_bar_at_bottom = false + -- ─── SSH Domains ─────────────────────────────────────────────────────────── + + config.ssh_domains = { + { + name = "muho", + remote_address = "muho", + username = "muon", + }, + } + -- ─── Shell ───────────────────────────────────────────────────────────────── ${lib.optionalString (shell != null) '' @@ -471,9 +493,11 @@ in { { key = "t", mods = "ALT", action = act.ShowTabNavigator }, -- Alt+q: quit { key = "q", mods = "ALT", action = act.QuitApplication }, - -- Ctrl+U/D: scroll half page (matches Alacritty) - { key = "u", mods = "CTRL", action = act.ScrollByPage(-0.5) }, - { key = "d", mods = "CTRL", action = act.ScrollByPage(0.5) }, + -- Ctrl+U/D: scroll half page when at the shell prompt; pass through + -- to the running program when it is using the alt screen (vim, less, + -- fzf, etc. switch to the alt screen and need the raw key). + { key = "u", mods = "CTRL", action = scroll_or_passthrough("u", -0.5) }, + { key = "d", mods = "CTRL", action = scroll_or_passthrough("d", 0.5) }, -- Copy / paste { key = "c", mods = "CTRL|SHIFT", action = act.CopyTo("Clipboard") }, { key = "v", mods = "CTRL|SHIFT", action = act.PasteFrom("Clipboard") },