Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions home/.config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,38 @@ 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

-- 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
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 same_text_hsb(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