Dim nvim background on focus loss to match tmux
NormalNC dims inactive splits; FocusLost/FocusGained dims the
whole editor when switching tmux panes or apps. Uses the same
#333333 as tmux pane-focus-out.

Assisted-by: Claude Opus 4.6 via Claude Code
change wknksovoppwplntytpsnnqxyyksorlpv
commit 79c5edbfc8dc991d87a92b5ded47f78b6a2fed2a
author Alpha Chen <alpha@kejadlen.dev>
date
parent yymsymss
diff --git a/.config/nvim/fnl/alphabaster/init.fnl b/.config/nvim/fnl/alphabaster/init.fnl
index b009358c..55246507 100644
--- a/.config/nvim/fnl/alphabaster/init.fnl
+++ b/.config/nvim/fnl/alphabaster/init.fnl
@@ -30,6 +30,7 @@
 
   ;;; Base
   (hi :Normal {:fg colors.fg :bg colors.bg})
+  (hi :NormalNC {:fg colors.fg :bg colors.dim-bg})  ;; inactive splits dimmed
   (hi :NormalFloat {:fg colors.fg :bg colors.black})
   (hi :FloatBorder {:fg colors.bright-black})
 
diff --git a/.config/nvim/fnl/alphabaster/palette.fnl b/.config/nvim/fnl/alphabaster/palette.fnl
index c5662a38..a316b5d8 100644
--- a/.config/nvim/fnl/alphabaster/palette.fnl
+++ b/.config/nvim/fnl/alphabaster/palette.fnl
@@ -31,7 +31,10 @@
    :comment-gray "#888888"
    :cursor     "#f2d5cf"
    :selection-bg "#626880"
-   :selection-fg "#c6d0f5"})
+   :selection-fg "#c6d0f5"
+
+   ;; Dimmed background for unfocused windows (matches tmux pane-focus-out)
+   :dim-bg     "#333333"})
 
 ;; Semantic roles (Alabaster philosophy)
 ;; Only 4 categories get color. Everything else is default fg.
diff --git a/.config/nvim/fnl/init.fnl b/.config/nvim/fnl/init.fnl
index 6ab3a866..6dc92eaf 100644
--- a/.config/nvim/fnl/init.fnl
+++ b/.config/nvim/fnl/init.fnl
@@ -271,6 +271,18 @@
                           "v:lua.vim.lsp.foldexpr()")))]
   (vim.api.nvim_create_autocmd :LspAttach {: callback}))
 
+;;; focus dimming
+;; Fade the background when neovim loses focus (matches tmux pane-focus-out behavior).
+;; FocusLost/FocusGained fire when the terminal pane loses/gains focus.
+(let [group (create-augroup :focus-dim {})
+      {: colors} (require :alphabaster.palette)]
+  (create-autocmd :FocusLost
+                  {:callback #(vim.api.nvim_set_hl 0 :Normal {:fg colors.fg :bg colors.dim-bg})
+                   : group})
+  (create-autocmd :FocusGained
+                  {:callback #(vim.api.nvim_set_hl 0 :Normal {:fg colors.fg :bg colors.bg})
+                   : group}))
+
 ;;; neovide
 
 ;; disable animation