From 1acc6137f4890e39d2a9fb002a353da987912501 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Thu, 30 Jul 2026 13:11:42 -0700 Subject: [PATCH 1/3] feat(wezterm): dim unfocused windows Register a window-focus-changed handler that applies a dimmed foreground_text_hsb and a lower window_background_opacity as per-window config overrides while a window is unfocused, and clears exactly those two keys on focus so the config's own defaults are restored. Unrelated per-window overrides are preserved across both transitions, and set_config_overrides() is only called when one of the two owned values actually changes, to avoid redundant config reloads. --- home/.config/wezterm/wezterm.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/home/.config/wezterm/wezterm.lua b/home/.config/wezterm/wezterm.lua index 8bb9ce80..6068fbba 100644 --- a/home/.config/wezterm/wezterm.lua +++ b/home/.config/wezterm/wezterm.lua @@ -10,4 +10,27 @@ config.macos_window_background_blur = 50 config.hide_tab_bar_if_only_one_tab = true config.window_decorations = "RESIZE" +-- Dim unfocused windows so the focused one is obvious at a glance. +local UNFOCUSED_FOREGROUND_TEXT_HSB = { hue = 1.0, saturation = 0.25, brightness = 0.45 } +local UNFOCUSED_WINDOW_BACKGROUND_OPACITY = 0.62 + +wezterm.on("window-focus-changed", function(window) + local overrides = window:get_config_overrides() or {} + local text_hsb, opacity + if not window:is_focused() then + text_hsb = UNFOCUSED_FOREGROUND_TEXT_HSB + opacity = UNFOCUSED_WINDOW_BACKGROUND_OPACITY + end + + -- Only write when one of the two values we own actually changes; a redundant + -- set_config_overrides() call would trigger another config reload. + if overrides.foreground_text_hsb == text_hsb and overrides.window_background_opacity == opacity then + return + end + + overrides.foreground_text_hsb = text_hsb + overrides.window_background_opacity = opacity + window:set_config_overrides(overrides) +end) + return config From 3aa73ad272095fa8d1592b1ecd39244a066490f3 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Thu, 30 Jul 2026 13:26:09 -0700 Subject: [PATCH 2/3] fix(wezterm): compare unfocused HSB structurally window:get_config_overrides() returns a copy, so the stored foreground_text_hsb is never the same table as the constant we last wrote. The identity comparison in the redundant-write guard was therefore always false while unfocused, so every repeated window-focus-changed event issued another set_config_overrides() call and triggered a config reload. Compare the hue/saturation/brightness fields instead. Behavior is otherwise unchanged: the same two override keys are applied while unfocused and cleared on focus, and unrelated overrides are preserved. --- home/.config/wezterm/wezterm.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/home/.config/wezterm/wezterm.lua b/home/.config/wezterm/wezterm.lua index 6068fbba..24041e72 100644 --- a/home/.config/wezterm/wezterm.lua +++ b/home/.config/wezterm/wezterm.lua @@ -14,6 +14,17 @@ config.window_decorations = "RESIZE" local UNFOCUSED_FOREGROUND_TEXT_HSB = { hue = 1.0, saturation = 0.25, brightness = 0.45 } local UNFOCUSED_WINDOW_BACKGROUND_OPACITY = 0.62 +-- get_config_overrides() hands back a copy, so the current value is never the +-- same table we last stored; compare the fields instead of the identity. +local function same_text_hsb(actual, expected) + if actual == nil or expected == nil then + return actual == expected + end + return actual.hue == expected.hue + and actual.saturation == expected.saturation + and actual.brightness == expected.brightness +end + wezterm.on("window-focus-changed", function(window) local overrides = window:get_config_overrides() or {} local text_hsb, opacity @@ -24,7 +35,7 @@ wezterm.on("window-focus-changed", function(window) -- Only write when one of the two values we own actually changes; a redundant -- set_config_overrides() call would trigger another config reload. - if overrides.foreground_text_hsb == text_hsb and overrides.window_background_opacity == opacity then + if same_text_hsb(overrides.foreground_text_hsb, text_hsb) and overrides.window_background_opacity == opacity then return end From 1fc984a77155ba3612880f7689946dd6334e1383 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Thu, 30 Jul 2026 13:37:22 -0700 Subject: [PATCH 3/3] no-mistakes(document): Documented dimmed unfocused WezTerm windows --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d55dfb98..de641b7e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Running the switch builds: - Nix user packages (ripgrep, fd, fzf, jq, lazygit, Neovim, Hack Nerd Font) - Shell (zsh, aliases, starship prompt) - Editor (Neovim config with the rose-pine moon theme) -- Terminal (WezTerm config with the rose-pine moon theme) +- Terminal (WezTerm config with the rose-pine moon theme and dimmed unfocused windows) - Agent configs (Claude, Codex, opencode all share one AGENTS.md) ## Prerequisites